I'm having a hard time calling the variable from first frame.
Posted
by iownfloppydisk
on Stack Overflow
See other posts from Stack Overflow
or by iownfloppydisk
Published on 2010-03-18T12:42:43Z
Indexed on
2010/03/18
12:51 UTC
Read the original article
Hit count: 281
here is how should my program be. In first frame, there is a textfield1 where a user input text and when he press a button, a new frame will be display with a textfield2 that displays the inputted text from the textfield1. please help me with the syntax. i'm still a beginner in java. much thanks guys.
First Frame:
textfield= new JTextField();
textfield.setPreferredSize( new Dimension(200,30) ) ;
textfield.setSize( textfield.getPreferredSize() ) ;
textfield.setLocation(95,198) ;
textfield.setSize(175,28);
cont.add(textfield);
public void actionPerformed(ActionEvent e) {
this.setVisible(false);
new Frame2().setVisible(true); //displays the 2nd frame right?
}
now i don't know what to do on my 2nd frame or where to start because i can't get the variable from the first frame
© Stack Overflow or respective owner