0

Hi, I have some question and hope that someone can help me to solve it.

When I click one button in JFrame form, then can the JFrame form hide and another JFrame form will appear?

Hope can provide some sample code on how to do it?

Thanks

2
Contributors
1
Reply
3
Views
9 Years
Discussion Span
Last Post by javaAddict
0

When you click the button you need to hide the current JFrame and call the other.

class JFrame_A extends JFrame {
....
....

public void methodBuitonClicked( ...... ) {
  JFrame_B frameB = new JFrame_B();
  this.setVisisble(false);
  frameB.setVisisble(true);
}
.....
.....
}

If you want from the frameB to go back to A you need to pass the A as an argument at the B frame: JFrame_B frameB = new JFrame_B(this); Of course you will need to have the appropriate attribute at the JFrame_B.
Then set the B frame visible false and the frame A that you passed as argument to true

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.