Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package game;
- import java.awt.event.KeyEvent;
- import javax.swing.JFrame;
- import javax.swing.JMenu;
- import javax.swing.JMenuBar;
- import javax.swing.JMenuItem;
- public class MenuCreation {
- public MenuCreation() {
- JFrame frame = new JFrame("Game");
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- JMenuBar menuBar = new JMenuBar();
- JMenu fileMenu = new JMenu("Start");
- fileMenu.setMnemonic(KeyEvent.VK_F);
- menuBar.add(fileMenu);
- JMenuItem newMenuItem = new JMenuItem("Nowa gra", KeyEvent.VK_N);
- fileMenu.add(newMenuItem);
- new Game();
- frame.setJMenuBar(menuBar);
- frame.setSize(400, 400);
- frame.setVisible(true);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement