/** * La classe Menu est utilisée pour créer le menu du jeu * * @version 0.1 * @author Adil HAMMERSCHMIDT & Lucas GRANDJEAN */ import java.awt.*; import javax.swing.JPanel; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JFrame; import javax.swing.border.BevelBorder; public class Menu extends JFrame { private JButton playBtn; private JButton playFromFileBtn; private JButton quitBtn; public Menu() { JFrame frame = new JFrame("SameGame by Lucas Grandjean & Adil Hammerschmidt"); frame.setPreferredSize(new Dimension(300, 300)); frame.add(new MenuPanel()); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } public class MenuPanel extends JPanel { public MenuPanel() { MenuListener mListener = new MenuListener(); setOpaque(true); setBackground(new Color(67,133,200)); setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.anchor = GridBagConstraints.NORTH; add(new JLabel("

SameGame


"), gbc); add(new JLabel("Lucas GRANDJEAN"), gbc); add(new JLabel("Adil HAMMERSCHMIDT
"), gbc); gbc.anchor = GridBagConstraints.CENTER; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(5, 0, 5, 0); JPanel buttons = new JPanel(new GridBagLayout()); buttons.setBackground(new Color(57,108,160)); buttons.setBorder(new BevelBorder(BevelBorder.RAISED)); playBtn = new JButton("Jouer"); playBtn.addActionListener(mListener); playFromFileBtn = new JButton("Charger une grille"); playFromFileBtn.addActionListener(mListener); quitBtn = new JButton("Quitter"); quitBtn.addActionListener(mListener); buttons.add(playBtn, gbc); buttons.add(playFromFileBtn, gbc); buttons.add(quitBtn, gbc); gbc.weighty = 1; add(buttons, gbc); } } }