import com.sun.xml.internal.ws.api.ResourceLoader;
import java.awt.image.BufferedImage;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.*;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/*
* Hauptmenü.java
*
* Created on 27.04.2015, 03:10:38
*/
/**
*
* @author riesyv
*/
public class Hauptmenü extends javax.swing.JFrame {
// JFrame-Objekt zum "Merken" des Startformulars
JFrame start = null;
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
BufferedImage image = null;
/** Creates new form Hauptmenü */
public Hauptmenü() {
try {
image = ImageIO.read(ResourceLoader.class.getResource("H:/Schule/Jahrgangsstufe 2/WI/Projekt/Bilder/hintergrund.jpeg"));
}
catch ( IOException e )
{
// e.printStackTrace();
}
initComponents();
}
/* public void Hintergrundbild(java.awt.event.ActionEvent evt){
try {
image = ImageIO.read(ResourceLoader.class.getResource("H:/Schule/Jahrgangsstufe 2/WI/Projekt/Bilder/hintergrund.jpeg"));
}
catch ( IOException e )
{
// e.printStackTrace();
}
}*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
lblTextWWM = new javax.swing.JLabel();
btnNeuesSpiel = new javax.swing.JButton();
btnSpielBeenden = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setForeground(java.awt.Color.white);
lblTextWWM.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
lblTextWWM.setText("Wer wird Millionär ?");
btnNeuesSpiel.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
btnNeuesSpiel.setText("Neues Spiel");
btnNeuesSpiel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnNeuesSpielActionPerformed(evt);
}
});
btnSpielBeenden.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
btnSpielBeenden.setText("Spiel beenden");
btnSpielBeenden.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnSpielBeendenActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(151, 151, 151)
.addComponent(lblTextWWM)
.addContainerGap(186, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(67, 67, 67)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(btnSpielBeenden, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 403, Short.MAX_VALUE)
.addComponent(btnNeuesSpiel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 403, Short.MAX_VALUE))
.addGap(78, 78, 78))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(lblTextWWM, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(50, 50, 50)
.addComponent(btnNeuesSpiel)
.addGap(61, 61, 61)
.addComponent(btnSpielBeenden)
.addContainerGap(74, Short.MAX_VALUE))
);
pack();
}// </editor-fold>
private void btnSpielBeendenActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);
}
private void btnNeuesSpielActionPerformed(java.awt.event.ActionEvent evt) {
// Startfenster unsichtbar machen
this.setVisible(false);
// Fensterobjekt für Formular Kundendaten anlegen
Spiel spiel = new Spiel();
// Aktuelles Fensterobjekt (Startfenster) zum "Merken" an das Folge-
// fenster übergeben - damit kann man das Startfenster beim Beenden
// des Formulars Spiel wieder sichtbar machen.
spiel.setHauptmenü(this);
// Fenster zum Lesen der Kundendaten sichtbar machen
spiel.setVisible(true);
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
Hauptmenü start = new Hauptmenü();
new Hauptmenü().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton btnNeuesSpiel;
private javax.swing.JButton btnSpielBeenden;
private javax.swing.JLabel lblTextWWM;
// End of variables declaration
}