How to pass values entered in one JFrame\'s text field as an input parameter in other JFrame?
Entered user name and password in first JFrame
through
You can also pass values to the constructor like this
Your main frame
public class MainFrame{
//
public void actionPerformed(ActionEvent ev){
FrameOne frameOne = new FrameOne(userField.getText(), passField.getText());
//you've passed the user and pass to other frame.
// then you can make it visible.
frameOne.setVisible(true);
}
}
Your next frame
public class FrameOne extends JFrame{
private String user;
private String pass;
public FrameOne(String usr, String pas){
this.user=usr;
this.pass=pas;
//define the components here
}
}