public class StartMenu extends JFrame {
public StartMenu() {
super();
initialize();
}
private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
private JLabel logoLabel = null;
private JButton einspielerBT = null;
private JButton zweispielerBT = null;
Mainmenu gui = new Mainmenu();
private JButton settings = null;
private JButton credits = null;
/**
*
*
* EinspielerModus/Singleplayer
*
*
*/
private JButton getEinspielerBT() {
if (einspielerBT == null) {
einspielerBT = new JButton();
einspielerBT.setBounds(new Rectangle(236, 87, 244, 50));
einspielerBT.setIcon(new ImageIcon(getClass().getResource("/ngmemory/imgs/button_01.png")));
einspielerBT.setEnabled(true);
einspielerBT.setRolloverIcon(new ImageIcon(getClass().getResource("/ngmemory/imgs/button_rollover_01.png")));
einspielerBT.setPressedIcon(new ImageIcon(getClass().getResource("/ngmemory/imgs/button_rollover_01.png")));
einspielerBT.setText("1 Spieler");
einspielerBT.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
gui.setVisible(true);
}
});
}
return einspielerBT;
}
/**
*
*
* ZweispielerModus/2Players
*
*
*/
private JButton getZweispielerBT() {
if (zweispielerBT == null) {
zweispielerBT = new JButton();
zweispielerBT.setText("2 Spieler ");
zweispielerBT.setIcon(new ImageIcon(getClass().getResource("/ngmemory/imgs/button_02.png")));
zweispielerBT.setEnabled(true);
zweispielerBT.setRolloverIcon(new ImageIcon(getClass().getResource("/ngmemory/imgs/button_rollover_02.png")));
zweispielerBT.setLocation(new Point(236, 144));
zweispielerBT.setSize(new Dimension(244, 50));
zweispielerBT.setPressedIcon(new ImageIcon(getClass().getResource("/ngmemory/imgs/button_rollover_02.png")));
zweispielerBT.setText("2 Spieler");
zweispielerBT.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
gui.setVisible(true);
}
});
}
return zweispielerBT;
}
/**
*
*
* Settings
*
*
*/
private JButton getSettings() {
if (settings == null) {
settings = new JButton();
settings.setEnabled(true);
settings.setLocation(new Point(236, 201));
settings.setText("Settings");
settings.setIcon(new ImageIcon(getClass().getResource("/ngmemory/imgs/button_03.png")));
settings.setRolloverIcon(new ImageIcon(getClass().getResource("/ngmemory/imgs/button_rollover_03.png")));
settings.setPressedIcon(new ImageIcon(getClass().getResource("/ngmemory/imgs/button_rollover_03.png")));
settings.setSize(new Dimension(244, 50));
settings.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed()
}
});
}
return settings;
}
/**
*
*
* Credits
*
*/
private JButton getCredits() {
if (credits == null) {
credits = new JButton();
credits.setEnabled(true);
credits.setSize(new Dimension(244, 50));
credits.setLocation(new Point(236, 258));
credits.setVisible(true);
credits.setPressedIcon(new ImageIcon(getClass().getResource("/ngmemory/imgs/button_rollover_04.png")));
credits.setRolloverIcon(new ImageIcon(getClass().getResource("/ngmemory/imgs/button_rollover_04.png")));
credits.setText("Credits");
credits.setIcon(new ImageIcon(getClass().getResource("/ngmemory/imgs/button_04.png")));
credits.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
System.out.println("actionPerformed()");
}
});
}
return credits;
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
StartMenu thisClass = new StartMenu();
thisClass.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
thisClass.setVisible(true);
}
});
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setSize(750, 450);
this.setContentPane(getJContentPane());
this.setTitle("New Generation Memory");
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
logoLabel = new JLabel();
logoLabel.setBounds(new Rectangle(-1, -1, 735, 415));
logoLabel.setIcon(new ImageIcon(getClass().getResource("/ngmemory/imgs/bg.png")));
logoLabel.setText("");
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.add(logoLabel, null);
jContentPane.add(getEinspielerBT(), null);
jContentPane.add(getZweispielerBT(), null);
jContentPane.add(getSettings(), null);
jContentPane.add(getCredits(), null);
}
return jContentPane;
}
} // @jve:decl-index=0:visual-constraint="10,10"