-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.java
25 lines (22 loc) · 899 Bytes
/
App.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
public class App extends JFrame {
public static void main(String[] args) {
JFrame screenOne = new JFrame("Screen 1");
screenOne.setVisible(true);
JButton nextScreen = new JButton("Next Screen");
screenOne.setSize(300,200);
screenOne.getContentPane().add(nextScreen);
//screenOne.pack(); - uncomment this line once we have more components --> then we can remove the screen dimensions
nextScreen.addActionListener(new ActionListener () {
@Override
public void actionPerformed(ActionEvent e) {
JFrame screenTwo = new JFrame("Screen 2");
screenTwo.setSize(300,200);
screenOne.setVisible(false);
screenTwo.setVisible(true);
}
});
}
}