Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Game2048;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.awt.event.KeyEvent;
- import java.util.ArrayList;
- import javax.swing.JFrame;
- import javax.swing.JMenu;
- import javax.swing.JMenuBar;
- import javax.swing.JMenuItem;
- import javax.swing.KeyStroke;
- import javax.swing.WindowConstants;
- public class Application {
- static ArrayList<Scores> scorelist = new ArrayList<Scores>() ;
- private static int WIDTH = 340;
- private static int HEIGHT = 430;
- public static int getWidth(){
- return WIDTH;
- }
- public static int getHeight(){
- return HEIGHT;
- }
- class MenuActionListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- System.out.println("Selected:");
- JFrame scored = new JFrame();
- scored.setTitle("Scores");//Create the menu bar.
- scored.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
- scored.setSize(250, 700);
- scored.setResizable(false);
- scored.setLocationRelativeTo(null);
- scored.setVisible(true);
- }
- }
- public static void main(String[] args) {
- JFrame game = new JFrame();
- game.setTitle("2048 App");//Create the menu bar.
- // menü berakása
- JMenuBar menuBar = new JMenuBar();
- game.setJMenuBar(menuBar);
- JMenu menu = new JMenu("A Menu");
- menu.setMnemonic(KeyEvent.VK_A);
- JMenuItem uj_jatek = new JMenuItem("Hajajaj");
- uj_jatek.setVisible(true);
- menu.add(uj_jatek);
- menuBar.add(menu);
- /////////////////////////
- JMenu menusc = new JMenu("Scores");
- menusc.setMnemonic(KeyEvent.VK_B);
- ////////////////////////
- JMenuItem list_scores = new JMenuItem("Mutasd a nyerteseket");
- list_scores.setVisible(true);
- menusc.add(list_scores);
- MenuActionListener lel = new MenuActionListener();
- list_scores.addActionListener(lel);
- ////////////////////////
- menuBar.add(menusc);
- //////////////////////
- game.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
- game.setSize(WIDTH, HEIGHT);
- game.setResizable(false);
- game.add(new Game2048());
- game.setLocationRelativeTo(null);
- game.setVisible(true);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement