I am new at Java Swing.
I have two Java files. One having main()
in it and the other is the GUI file.
Client
class Client
{
GUI gui;
public static void main(String args[])
{
//.......... do something.......
gui = new GUI();
// at thin point I want to have value of gui.s1 ....
//but main() actually do not wait for the user input.
}
}
GUI
class GUI extends JFrame implements ActionListener
{
String s1="";
GUI()
{
JTextField t1= new JTextField(20);
JButton j1= new JButton("submit");
j1.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
s1=t1.getText();
}
}
Please guide me, and if it is not appropriate question then please suggest me the article that you think I should read to get the concept.