-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMainScreen.java
More file actions
59 lines (43 loc) · 1.31 KB
/
Copy pathMainScreen.java
File metadata and controls
59 lines (43 loc) · 1.31 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
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
public class MainScreen extends JFrame {
Icon icon = new ImageIcon(MainScreen.class.getResource("giphy.gif"));
public static void main(String[] args) {
MainScreen frame = new MainScreen();
frame.setVisible(true);
}
/**
* Create the frame.
*/
public MainScreen() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
JMenuBar menuBar = new JMenuBar();
this.setJMenuBar(menuBar);
JMenu mnFile = new JMenu("File");
menuBar.add(mnFile);
JMenuItem mntmTictactoe = new JMenuItem("TicTacToe");
mntmTictactoe.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
TicTacToe obj = new TicTacToe();
obj.setVisible(true);
}
});
mnFile.add(mntmTictactoe);
JMenuItem mntmLogoquiz = new JMenuItem("LogoQuiz");
mnFile.add(mntmLogoquiz);
mnFile.addSeparator();
JMenuItem mntmExit = new JMenuItem("Exit");
mnFile.add(mntmExit);
JLabel lblNewLabel = new JLabel();
lblNewLabel.setIcon(icon);
getContentPane().add(lblNewLabel);
}
}