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
| protected static JPanel bas;
protected static JLabel score;
protected static JLabel jeton;
protected static JLabel scoreSelection;
private static int nombrePoint;
private static int nombreJeton;
private static int monScoreSelection;
public Fenetre(){
nombrePoint=0;
nombreJeton=0;
monScoreSelection=0;
setSize(600,400);
Panneau monPanneau = new Panneau();
JScrollPane monScrollPane = new JScrollPane(monPanneau, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
monScrollPane.setViewportView(monPanneau);
monScrollPane.setVisible(true);
monScrollPane.createVerticalScrollBar();
monPanneau.setVisible(true);
bas = new JPanel();
bas.setLayout(new GridLayout(0,3));
jeton = new JLabel();
score = new JLabel();
scoreSelection = new JLabel();
bas.add(jeton,0,0);
bas.add(scoreSelection,0,0);
bas.add(score,0,2);
setNombrePoint();
setNombreJeton();
add(monScrollPane,"Center");
add(bas, "South");
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JMenuBar menuBarre = new JMenuBar();
setJMenuBar(menuBarre);
JMenu fichier = new JMenu("Fichier");
menuBarre.add(fichier);
JMenuItem nouveau = new JMenuItem(new NouveauJeuAction("Nouveau Jeu"));
JMenuItem quitter = new JMenuItem(new QuitterAction("Quitter"));
fichier.add(nouveau);
fichier.add(quitter);
quitter.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q,InputEvent.CTRL_MASK));
nouveau.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N,InputEvent.CTRL_MASK));
} |
Partager