-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathMainScreen.java
More file actions
66 lines (52 loc) · 1.54 KB
/
MainScreen.java
File metadata and controls
66 lines (52 loc) · 1.54 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class MainScreen extends JFrame {
private JPanel contentPane;
private void launchTicTac(){
TicTacToe tic = new TicTacToe();
tic.setVisible(true);
}
/**
* Launch the application.
*/
/**
* Create the frame.
*/
public MainScreen() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 540, 518);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
contentPane.setLayout(null);
setContentPane(contentPane);
JLabel lblNewLabel = new JLabel("");
lblNewLabel.setIcon(new ImageIcon(MainScreen.class.getResource("main2.gif")));
lblNewLabel.setBounds(6, 57, 528, 404);
contentPane.add(lblNewLabel);
JMenuBar menuBar = new JMenuBar();
setJMenuBar(menuBar);
JMenu mnGame = new JMenu("Game");
menuBar.add(mnGame);
JMenuItem mntmTictactoe = new JMenuItem("TicTacToe");
mntmTictactoe.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
launchTicTac();
}
});
mnGame.add(mntmTictactoe);
JMenuItem mntmLogoQuiz = new JMenuItem("Logo Quiz");
mnGame.add(mntmLogoQuiz);
JMenuItem mntmKbc = new JMenuItem("KBC");
mnGame.add(mntmKbc);
JMenuItem mntmExit = new JMenuItem("Exit");
mnGame.add(mntmExit);
}
}