Skip to content

Instantly share code, notes, and snippets.

Created February 18, 2015 14:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/b22ca47a6551821b5a18 to your computer and use it in GitHub Desktop.
Save anonymous/b22ca47a6551821b5a18 to your computer and use it in GitHub Desktop.
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package frames;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.event.MouseEvent;
import java.awt.event.MouseAdapter;
/**
*
* @author Timo Frenzel
*/
public class CharGenFrame extends JFrame {
/**
* Creates new form CharGenFrame
*/
public CharGenFrame() {
initComponents();
}
/**
* 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.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jTextField2 = new javax.swing.JTextField();
mainMenueBar = new javax.swing.JMenuBar();
fileItem = new javax.swing.JMenu();
newCharItem = new javax.swing.JMenuItem();
loadCharItem = new javax.swing.JMenuItem();
saveCharItem = new javax.swing.JMenuItem();
printCharItem = new javax.swing.JMenuItem();
helpItem = new javax.swing.JMenu();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Midgard Charakter Generator");
getContentPane().setLayout(new java.awt.CardLayout());
jTextField2.setText("jTextField2");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(89, 89, 89)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(166, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(42, 42, 42)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(217, Short.MAX_VALUE))
);
getContentPane().add(jPanel1, "card2");
fileItem.setText("Datei");
newCharItem.setText("Neuer Char");
fileItem.add(newCharItem);
loadCharItem.setText("Char laden");
fileItem.add(loadCharItem);
saveCharItem.setText("Char Speichern");
fileItem.add(saveCharItem);
printCharItem.setText("Char drucken");
fileItem.add(printCharItem);
mainMenueBar.add(fileItem);
helpItem.setText("Hilfe");
helpItem.addMouseListener(new java.awt.event.MouseAdapter() {
public void mousePressed(java.awt.event.MouseEvent evt) {
helpItemMousePressed(evt);
}
});
mainMenueBar.add(helpItem);
setJMenuBar(mainMenueBar);
pack();
}// </editor-fold>
private void helpItemMousePressed(java.awt.event.MouseEvent evt) {
// TODO add your handling code here:
this.jTextField2.setText("wwww");
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(CharGenFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(CharGenFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(CharGenFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(CharGenFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new CharGenFrame().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JMenu fileItem;
private javax.swing.JMenu helpItem;
private javax.swing.JPanel jPanel1;
private javax.swing.JTextField jTextField2;
private javax.swing.JMenuItem loadCharItem;
private javax.swing.JMenuBar mainMenueBar;
private javax.swing.JMenuItem newCharItem;
private javax.swing.JMenuItem printCharItem;
private javax.swing.JMenuItem saveCharItem;
// End of variables declaration
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment