From 3c7457f9e1de741f5f2ee0c2abd81946992e7134 Mon Sep 17 00:00:00 2001 From: simono41 Date: Mon, 21 Nov 2016 01:03:44 +0100 Subject: [PATCH] GUI MAIN Methode --- nbproject/project.properties | 2 +- src/main.java | 28 +++++++++++++++++++ src/vokabeltrainer/GUI.java | 47 ++++++++++---------------------- src/vokabeltrainer/Vokabeln.java | 29 -------------------- 4 files changed, 43 insertions(+), 63 deletions(-) create mode 100644 src/main.java diff --git a/nbproject/project.properties b/nbproject/project.properties index c4e45f1..ec8afd5 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -54,7 +54,7 @@ javadoc.splitindex=true javadoc.use=true javadoc.version=false javadoc.windowtitle= -main.class=vokabeltrainer.GUI +main.class=main manifest.file=manifest.mf meta.inf.dir=${src.dir}/META-INF mkdist.disabled=false diff --git a/src/main.java b/src/main.java new file mode 100644 index 0000000..336454c --- /dev/null +++ b/src/main.java @@ -0,0 +1,28 @@ + +import vokabeltrainer.GUI; + +/* + * 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. + */ + +/** + * + * @author simono41 + */ +public class main { + public static void main (String[] args) { + 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 | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(GUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + new GUI().setVisible(true); + } +} diff --git a/src/vokabeltrainer/GUI.java b/src/vokabeltrainer/GUI.java index 882f1fd..15e8d6f 100644 --- a/src/vokabeltrainer/GUI.java +++ b/src/vokabeltrainer/GUI.java @@ -242,7 +242,7 @@ public class GUI extends javax.swing.JFrame { private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed // TODO add your handling code here: - Vokabeln.main(null); + this.vokabeln(); }//GEN-LAST:event_jButton4ActionPerformed private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed @@ -265,7 +265,19 @@ public class GUI extends javax.swing.JFrame { this.aktualisieren(); }//GEN-LAST:event_jButton5ActionPerformed - + private void vokabeln() { + 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 | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(GUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + new Vokabeln().setVisible(true); + } private void vokabel() { this.aktualisieren(); vokabeln0.add(this.jTextField1.getText()); @@ -339,38 +351,7 @@ public class GUI extends javax.swing.JFrame { this.jLabel5.setText(Integer.toString(richtig)); this.jLabel6.setText(Integer.toString(falsch)); } - - /** - * @param args the command line arguments - */ - public static void main(String args[]) { - /* Set the Nimbus look and feel */ - // - /* 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 | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) { - java.util.logging.Logger.getLogger(GUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); - } - // - - // - - /* Create and display the form */ - java.awt.EventQueue.invokeLater(() -> { - new GUI().setVisible(true); - }); - - // Variables declaration - do not modify//GEN-BEGIN:variables // End of variables declaration//GEN-END:variables - } } \ No newline at end of file diff --git a/src/vokabeltrainer/Vokabeln.java b/src/vokabeltrainer/Vokabeln.java index 8873c9e..a1e3d11 100644 --- a/src/vokabeltrainer/Vokabeln.java +++ b/src/vokabeltrainer/Vokabeln.java @@ -76,35 +76,6 @@ public class Vokabeln extends javax.swing.JFrame { this.jList1.setModel(dim); }//GEN-LAST:event_jButton1ActionPerformed - /** - * @param args the command line arguments - */ - public static void main(String args[]) { - /* Set the Nimbus look and feel */ - // - /* 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 | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) { - java.util.logging.Logger.getLogger(Vokabeln.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); - } - // - - // - - /* Create and display the form */ - java.awt.EventQueue.invokeLater(() -> { - new Vokabeln().setVisible(true); - }); - } - // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButton1; private javax.swing.JList jList1;