import javax.swing.*; import java.awt.*; import java .awt.event.*; import java.io.*; import java.net.*; import java.util.*; public class framew extends JFrame implements Runnable, ActionListener{ String[] data= new String [3]; JTextField tone, ttwo, tthree; public boolean status=false; public boolean inprog=true; Thread t1; boolean tru=true; public JButton quit, submit; public framew(int k, int total, String path, String fname){ super("CRPC"); System.out.println("start new frame"); getContentPane().setLayout(new FlowLayout()); System.out.println("the frame part of raj entered...."); setSize(600,300); JLabel title = new JLabel(); title.setText(fname); getContentPane().add(title, BorderLayout.CENTER); JLabel count = new JLabel("Total number of files are.......... : " +total); JLabel head = new JLabel("Enter the details of file number....... :" +k); JLabel one = new JLabel("Enter the Host name here:"); JLabel two = new JLabel("Enter the Path here:"); JLabel three = new JLabel("Enter the File name here:"); tone = new JTextField(40); ttwo = new JTextField(50); tthree = new JTextField(40); add(count); add(head); add(one); add(tone); add(two); add(ttwo); add(three); add(tthree); JButton submit = new JButton("Submit"); JButton quit = new JButton("Done"); add(submit); add(quit); setVisible(true); show(); submit.addActionListener(this); quit.addActionListener(this); t1 = new Thread (this, "t1"); System.out.println("initialising my thread....."); t1.start(); tone.setText("osprey4.npac.syr.edu"); ttwo.setText("/npac/home/webflow/WEBFLOW/BeanContext_2.2.2/GatewayTest "); tthree.setText("read.txt"); } public void run(){ System.out.println("running my thread....."); // while (true){ try{ Thread.sleep( (int) (Math.random() * 3000) ); } catch (InterruptedException e){ e.printStackTrace(); } // } } public void actionPerformed(ActionEvent e){ if (e.getActionCommand().equals("Submit")) { System.out.println("Submit button pressed...."); status=true; } if (e.getActionCommand().equals("Done")) { System.out.println("done button pressed......"); inprog=false; t1.stop(); } } public boolean getStatus() { // System.out.println("returning status......: " +status); return status; } public void resetStatus() { System.out.println("status of my frame is false..."); status=false; } public boolean quit() { //System.out.println("returning inprog....: " +inprog); return inprog; } public void exwin() { System.exit(1); } }