Question: How do I action perfom open a new GUI from a click of a button. In other words how do I take my current GUI

 How do I action perfom open a new GUI from a click of a button. In other words how do I take my current GUI and lauch another GUI with the information I have. import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class GUI implements ActionListener { public GUI(){ JFrame frame = new JFrame(); JLabel label = new JLabel("Program uses Java Gui message and input dialogs."); JLabel label2 = new JLabel("Program evaluates integers as even or odd."); JLabel label3 = new JLabel("Note: Program does *not* perform data validation."); ImageIcon icon = new ImageIcon("icon.png"); JButton button = new JButton("OK"); button.addActionListener(this); JPanel panel = new JPanel(); panel.setBorder(BorderFactory.createEmptyBorder(30, 30, 10, 30)); panel.setLayout(new GridLayout(0,1)); JLabel image = new JLabel(icon); panel.add(image); panel.add(label); panel.add(label2); panel.add(label3); panel.add(button); frame.add(panel); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setIconImage(icon.getImage()); frame.setTitle("Message"); frame.pack(); frame.setVisible(true); } public static void main(String[] args) { new GUI(); } @Override public void actionPerformed(ActionEvent e) { //open new GUI } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!