use multiple gui displays
I have a noob question here.
Im creating a program to keep track of my dvd collection. When it starts up it has a page with two Jbuttons. One listed to create a new record and one to view the titles currently owned. My question is how do i link this gui's page with an action so that when i click on the "New Movie" button for example it brings up the gui i created that allows me to enter in the information for the movie.
I used javafx to create the guis and they are each currently in their own separate JFrame form as separate classes. Some guidance here would be great. Thanks
Re: use multiple gui displays
Ok, so lets say you created a GUI that extends JFrame named NewMovieFrame. The code to allow the JButton to open the frame would look like this:
Code java:
//Our Button that will open the new JFrame
JButton openFrame = new JButton("Open Frame");
//We add an actionListener to the JButton
openFrame.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
/* If the constructor of the NewMovieFrame JFrame
* sets itself visible, we just need to construct
* the NewMovieFrame JFrame like this:
*/
new NewMovieFrame(...);
/* If however the NewMovieFrame JFrame does not set
* itself visible in the constructor, we need to do
* this:
*/
NewMovieFrame temp = new NewMovieFrame(...);
temp.setVisible(true);
}
});
//Assume we add the openFrame JButton to our main GUI
If you show the code you have, I can help you more directly, instead of just using the example above.