I'm using the Java GUI for the first time through Netbeans. I'm trying to design some basic hotel software, and for that I'm trying to implement multiple screens through multiple JFrames.
What I don't know is how to get the jFrame I'm using to go invisible and another jFrame to go visible when a button in my current jFrame is clicked.
I have a class, Hotel with this code:
public static void main(String[] args) {
// TODO code application logic here
HotelMain h = new HotelMain();
HotelBooking b = new HotelBooking();
h.setVisible(true);
}
HotelMain and HotelBooking are 2 separate jFrame files. I'm trying to get HotelMain to disappear and HotelBooking to appear when a button is clicked on the HotelMain screen.
And this is some code from the main function in HotelMain. Should this even be there? Also, how do I use this to get the jFrame to disappear?
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new HotelMain().setVisible(true);
}
}