Compare commits
7 commits
Author | SHA1 | Date | |
---|---|---|---|
|
18ddbec910 | ||
|
2391dee6f2 | ||
|
6fa618a71f | ||
|
70ece9ee3d | ||
|
b0e97c247e | ||
|
3c7457f9e1 | ||
|
acfb5aa6a9 |
11 changed files with 331 additions and 111 deletions
42
Vokabeln.txt
42
Vokabeln.txt
|
@ -1,3 +1,41 @@
|
||||||
Vokabeln:
|
Vokabeln:
|
||||||
Vokabel
|
training
|
||||||
Vokabel
|
Ausbildung
|
||||||
|
qualification
|
||||||
|
Abschluss
|
||||||
|
apprenticeship
|
||||||
|
Lehre
|
||||||
|
apprentice
|
||||||
|
Auszubildener
|
||||||
|
decision
|
||||||
|
Entscheidung
|
||||||
|
chef
|
||||||
|
Koch
|
||||||
|
childcare assistant
|
||||||
|
Kinderpfleger
|
||||||
|
mechanic
|
||||||
|
Mechaniker
|
||||||
|
garage
|
||||||
|
Autowerkstatt
|
||||||
|
customer adviser
|
||||||
|
Kundenbetreuer
|
||||||
|
advise
|
||||||
|
beraten
|
||||||
|
advice
|
||||||
|
Rat
|
||||||
|
make-up artist
|
||||||
|
Maskenbildner
|
||||||
|
fitness instructor
|
||||||
|
lange arbeiten
|
||||||
|
serve
|
||||||
|
bedienen
|
||||||
|
repair
|
||||||
|
reparieren
|
||||||
|
sporty
|
||||||
|
sportlich
|
||||||
|
artistic
|
||||||
|
kuenstlerisch
|
||||||
|
organized
|
||||||
|
organisiert
|
||||||
|
calm
|
||||||
|
ruhig
|
||||||
|
|
|
@ -54,7 +54,7 @@ javadoc.splitindex=true
|
||||||
javadoc.use=true
|
javadoc.use=true
|
||||||
javadoc.version=false
|
javadoc.version=false
|
||||||
javadoc.windowtitle=
|
javadoc.windowtitle=
|
||||||
main.class=vokabeltrainer.GUI
|
main.class=main
|
||||||
manifest.file=manifest.mf
|
manifest.file=manifest.mf
|
||||||
meta.inf.dir=${src.dir}/META-INF
|
meta.inf.dir=${src.dir}/META-INF
|
||||||
mkdist.disabled=false
|
mkdist.disabled=false
|
||||||
|
|
30
src/main.java
Normal file
30
src/main.java
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
|
||||||
|
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);
|
||||||
|
GUI a = new GUI();
|
||||||
|
a.aktualisieren();
|
||||||
|
}
|
||||||
|
}
|
|
@ -20,6 +20,7 @@ public class read {
|
||||||
while ((zeile = br.readLine()) != null) {
|
while ((zeile = br.readLine()) != null) {
|
||||||
GUI.vokabeln0.add(zeile);
|
GUI.vokabeln0.add(zeile);
|
||||||
}
|
}
|
||||||
|
br.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
30
src/readandwrite/readandremove.java
Normal file
30
src/readandwrite/readandremove.java
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
/*
|
||||||
|
* 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 readandwrite;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author simono41
|
||||||
|
*/
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import vokabeltrainer.Vokabeln;
|
||||||
|
|
||||||
|
public class readandremove {
|
||||||
|
public void read() throws FileNotFoundException, IOException {
|
||||||
|
String zeile;
|
||||||
|
FileReader fr = new FileReader("./Vokabeln.old.txt");
|
||||||
|
try (BufferedReader br = new BufferedReader(fr)) {
|
||||||
|
br.readLine();
|
||||||
|
while ((zeile = br.readLine()) != null) {
|
||||||
|
Vokabeln.vokabeln0.add(zeile);
|
||||||
|
}
|
||||||
|
br.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
26
src/readandwrite/remove.java
Normal file
26
src/readandwrite/remove.java
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
/*
|
||||||
|
* 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 readandwrite;
|
||||||
|
|
||||||
|
import java.io.BufferedWriter;
|
||||||
|
import java.io.FileWriter;
|
||||||
|
import java.io.IOException;
|
||||||
|
import vokabeltrainer.Vokabeln;
|
||||||
|
|
||||||
|
public class remove {
|
||||||
|
public void write() throws IOException {
|
||||||
|
FileWriter fw = new FileWriter("./Vokabeln.old.txt");
|
||||||
|
try (BufferedWriter bw = new BufferedWriter(fw)) {
|
||||||
|
bw.write("Vokabelnold:");
|
||||||
|
bw.newLine();
|
||||||
|
for (String str : Vokabeln.vokabeln0) {
|
||||||
|
bw.write(str);
|
||||||
|
bw.newLine();
|
||||||
|
}
|
||||||
|
bw.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -20,6 +20,7 @@ public class write {
|
||||||
bw.write(str);
|
bw.write(str);
|
||||||
bw.newLine();
|
bw.newLine();
|
||||||
}
|
}
|
||||||
|
bw.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,38 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
|
||||||
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
|
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
|
||||||
|
<NonVisualComponents>
|
||||||
|
<Menu class="javax.swing.JMenuBar" name="jMenuBar1">
|
||||||
|
<SubComponents>
|
||||||
|
<Menu class="javax.swing.JMenu" name="jMenu1">
|
||||||
|
<Properties>
|
||||||
|
<Property name="text" type="java.lang.String" value="File"/>
|
||||||
|
</Properties>
|
||||||
|
<SubComponents>
|
||||||
|
<MenuItem class="javax.swing.JMenuItem" name="jMenuItem1">
|
||||||
|
<Properties>
|
||||||
|
<Property name="text" type="java.lang.String" value="EXIT"/>
|
||||||
|
</Properties>
|
||||||
|
<Events>
|
||||||
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItem1ActionPerformed"/>
|
||||||
|
</Events>
|
||||||
|
</MenuItem>
|
||||||
|
</SubComponents>
|
||||||
|
</Menu>
|
||||||
|
<Menu class="javax.swing.JMenu" name="jMenu2">
|
||||||
|
<Properties>
|
||||||
|
<Property name="text" type="java.lang.String" value="Edit"/>
|
||||||
|
</Properties>
|
||||||
|
</Menu>
|
||||||
|
</SubComponents>
|
||||||
|
</Menu>
|
||||||
|
</NonVisualComponents>
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="defaultCloseOperation" type="int" value="3"/>
|
<Property name="defaultCloseOperation" type="int" value="3"/>
|
||||||
|
<Property name="title" type="java.lang.String" value="Vokabeltrainer"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
<SyntheticProperties>
|
<SyntheticProperties>
|
||||||
|
<SyntheticProperty name="menuBar" type="java.lang.String" value="jMenuBar1"/>
|
||||||
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
||||||
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
|
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
|
||||||
</SyntheticProperties>
|
</SyntheticProperties>
|
||||||
|
@ -108,7 +136,7 @@
|
||||||
<Component id="jLabel8" alignment="3" min="-2" max="-2" attributes="0"/>
|
<Component id="jLabel8" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
<EmptySpace pref="38" max="32767" attributes="0"/>
|
<EmptySpace pref="17" max="32767" attributes="0"/>
|
||||||
<Group type="103" groupAlignment="3" attributes="0">
|
<Group type="103" groupAlignment="3" attributes="0">
|
||||||
<Component id="jButton4" alignment="3" min="-2" max="-2" attributes="0"/>
|
<Component id="jButton4" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="jButton5" alignment="3" min="-2" max="-2" attributes="0"/>
|
<Component id="jButton5" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
|
@ -186,7 +214,7 @@
|
||||||
</Component>
|
</Component>
|
||||||
<Component class="javax.swing.JLabel" name="jLabel7">
|
<Component class="javax.swing.JLabel" name="jLabel7">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="text" type="java.lang.String" value="Eingabe = "/>
|
<Property name="text" type="java.lang.String" value="Loesung = "/>
|
||||||
</Properties>
|
</Properties>
|
||||||
</Component>
|
</Component>
|
||||||
<Component class="javax.swing.JLabel" name="jLabel8">
|
<Component class="javax.swing.JLabel" name="jLabel8">
|
||||||
|
|
|
@ -5,14 +5,12 @@
|
||||||
*/
|
*/
|
||||||
package vokabeltrainer;
|
package vokabeltrainer;
|
||||||
|
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import javax.swing.JButton;
|
|
||||||
import javax.swing.JLabel;
|
|
||||||
import javax.swing.JTextField;
|
|
||||||
import readandwrite.read;
|
import readandwrite.read;
|
||||||
import readandwrite.write;
|
import readandwrite.write;
|
||||||
|
|
||||||
|
@ -21,29 +19,12 @@ import readandwrite.write;
|
||||||
* @author simono41
|
* @author simono41
|
||||||
*/
|
*/
|
||||||
public class GUI extends javax.swing.JFrame {
|
public class GUI extends javax.swing.JFrame {
|
||||||
|
|
||||||
public static ArrayList<String> vokabeln0 = new ArrayList();
|
public static ArrayList<String> vokabeln0 = new ArrayList();
|
||||||
public static String vokabel1;
|
public static String vokabel1;
|
||||||
public static String vokabel2;
|
public static String vokabel2;
|
||||||
public static int richtig;
|
public static int richtig;
|
||||||
public static int falsch;
|
public static int falsch;
|
||||||
private JTextField jTextField1;
|
|
||||||
private JTextField jTextField2;
|
|
||||||
private JLabel jLabel1;
|
|
||||||
private JLabel jLabel2;
|
|
||||||
private JButton jButton1;
|
|
||||||
private JButton jButton2;
|
|
||||||
private JLabel jLabel3;
|
|
||||||
private JLabel jLabel4;
|
|
||||||
private JLabel jLabel5;
|
|
||||||
private JLabel jLabel6;
|
|
||||||
private JLabel jLabel7;
|
|
||||||
private JLabel jLabel8;
|
|
||||||
private JButton jButton3;
|
|
||||||
private JButton jButton4;
|
|
||||||
private JLabel jLabel9;
|
|
||||||
private JLabel jLabel10;
|
|
||||||
private JButton jButton5;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new form GUI
|
* Creates new form GUI
|
||||||
|
@ -78,8 +59,13 @@ public class GUI extends javax.swing.JFrame {
|
||||||
jLabel9 = new javax.swing.JLabel();
|
jLabel9 = new javax.swing.JLabel();
|
||||||
jLabel10 = new javax.swing.JLabel();
|
jLabel10 = new javax.swing.JLabel();
|
||||||
jButton5 = new javax.swing.JButton();
|
jButton5 = new javax.swing.JButton();
|
||||||
|
jMenuBar1 = new javax.swing.JMenuBar();
|
||||||
|
jMenu1 = new javax.swing.JMenu();
|
||||||
|
jMenuItem1 = new javax.swing.JMenuItem();
|
||||||
|
jMenu2 = new javax.swing.JMenu();
|
||||||
|
|
||||||
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
||||||
|
setTitle("Vokabeltrainer");
|
||||||
|
|
||||||
jTextField1.setText("Vokabel");
|
jTextField1.setText("Vokabel");
|
||||||
|
|
||||||
|
@ -116,7 +102,7 @@ public class GUI extends javax.swing.JFrame {
|
||||||
|
|
||||||
jLabel6.setText("0");
|
jLabel6.setText("0");
|
||||||
|
|
||||||
jLabel7.setText("Eingabe = ");
|
jLabel7.setText("Loesung = ");
|
||||||
|
|
||||||
jLabel8.setText("n");
|
jLabel8.setText("n");
|
||||||
|
|
||||||
|
@ -145,6 +131,23 @@ public class GUI extends javax.swing.JFrame {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
jMenu1.setText("File");
|
||||||
|
|
||||||
|
jMenuItem1.setText("EXIT");
|
||||||
|
jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
jMenuItem1ActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
jMenu1.add(jMenuItem1);
|
||||||
|
|
||||||
|
jMenuBar1.add(jMenu1);
|
||||||
|
|
||||||
|
jMenu2.setText("Edit");
|
||||||
|
jMenuBar1.add(jMenu2);
|
||||||
|
|
||||||
|
setJMenuBar(jMenuBar1);
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||||
getContentPane().setLayout(layout);
|
getContentPane().setLayout(layout);
|
||||||
layout.setHorizontalGroup(
|
layout.setHorizontalGroup(
|
||||||
|
@ -217,7 +220,7 @@ public class GUI extends javax.swing.JFrame {
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
.addComponent(jLabel7)
|
.addComponent(jLabel7)
|
||||||
.addComponent(jLabel8)))
|
.addComponent(jLabel8)))
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 38, Short.MAX_VALUE)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 17, Short.MAX_VALUE)
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
.addComponent(jButton4)
|
.addComponent(jButton4)
|
||||||
.addComponent(jButton5))
|
.addComponent(jButton5))
|
||||||
|
@ -234,15 +237,19 @@ public class GUI extends javax.swing.JFrame {
|
||||||
|
|
||||||
private void jTextField2KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField2KeyPressed
|
private void jTextField2KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField2KeyPressed
|
||||||
// TODO add your handling code here:
|
// TODO add your handling code here:
|
||||||
if (evt.getKeyCode() == 10) {
|
if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
|
||||||
System.out.println("ENTER");
|
System.out.println("ENTER");
|
||||||
this.eingabe();
|
this.eingabe();
|
||||||
}
|
}
|
||||||
|
if (evt.getKeyCode() == KeyEvent.VK_ALT) {
|
||||||
|
System.out.println("Neue Vokabel");
|
||||||
|
this.vokabel();
|
||||||
|
}
|
||||||
}//GEN-LAST:event_jTextField2KeyPressed
|
}//GEN-LAST:event_jTextField2KeyPressed
|
||||||
|
|
||||||
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
|
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
|
||||||
// TODO add your handling code here:
|
// TODO add your handling code here:
|
||||||
Vokabeln.main(null);
|
this.vokabeln();
|
||||||
}//GEN-LAST:event_jButton4ActionPerformed
|
}//GEN-LAST:event_jButton4ActionPerformed
|
||||||
|
|
||||||
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
|
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
|
||||||
|
@ -265,16 +272,25 @@ public class GUI extends javax.swing.JFrame {
|
||||||
this.aktualisieren();
|
this.aktualisieren();
|
||||||
}//GEN-LAST:event_jButton5ActionPerformed
|
}//GEN-LAST:event_jButton5ActionPerformed
|
||||||
|
|
||||||
|
private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
|
||||||
|
// TODO add your handling code here:
|
||||||
|
System.exit(0);
|
||||||
|
}//GEN-LAST:event_jMenuItem1ActionPerformed
|
||||||
|
|
||||||
|
private void vokabeln() {
|
||||||
|
new Vokabeln().setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
private void vokabel() {
|
private void vokabel() {
|
||||||
this.aktualisieren();
|
this.aktualisieren();
|
||||||
vokabeln0.add(this.jTextField1.getText());
|
vokabeln0.add(this.jTextField1.getText());
|
||||||
vokabeln0.add(this.jTextField2.getText());
|
vokabeln0.add(this.jTextField2.getText());
|
||||||
|
this.jTextField1.setText("");
|
||||||
|
this.jTextField2.setText("");
|
||||||
write a = new write();
|
write a = new write();
|
||||||
try {
|
try {
|
||||||
a.write();
|
a.write();
|
||||||
}
|
} catch (IOException ex) {
|
||||||
catch (IOException ex) {
|
|
||||||
Logger.getLogger(GUI.class.getName()).log(Level.SEVERE, null, ex);
|
Logger.getLogger(GUI.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -283,19 +299,18 @@ public class GUI extends javax.swing.JFrame {
|
||||||
if (this.jTextField2.getText().equals(vokabel1)) {
|
if (this.jTextField2.getText().equals(vokabel1)) {
|
||||||
System.out.println("Richtig");
|
System.out.println("Richtig");
|
||||||
++richtig;
|
++richtig;
|
||||||
this.jLabel8.setText("Richtig");
|
|
||||||
} else {
|
} else {
|
||||||
System.out.println("Falsch");
|
System.out.println("Falsch");
|
||||||
++falsch;
|
++falsch;
|
||||||
this.jLabel8.setText("Falsch");
|
|
||||||
}
|
}
|
||||||
|
this.jLabel8.setText(vokabel1);
|
||||||
this.zufall();
|
this.zufall();
|
||||||
this.jTextField2.setText("");
|
this.jTextField2.setText("");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void zufall() {
|
private void zufall() {
|
||||||
int gerade;
|
int gerade;
|
||||||
int zufallszahl = (int)(Math.random() * (double)vokabeln0.size());
|
int zufallszahl = (int) (Math.random() * (double) vokabeln0.size());
|
||||||
System.out.println(zufallszahl);
|
System.out.println(zufallszahl);
|
||||||
System.out.println(vokabeln0.size());
|
System.out.println(vokabeln0.size());
|
||||||
if (zufallszahl % 2 == 0) {
|
if (zufallszahl % 2 == 0) {
|
||||||
|
@ -322,53 +337,41 @@ public class GUI extends javax.swing.JFrame {
|
||||||
this.jLabel10.setText("" + zufallszahl + "." + gerade);
|
this.jLabel10.setText("" + zufallszahl + "." + gerade);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void aktualisieren() {
|
public void aktualisieren() {
|
||||||
vokabeln0.clear();
|
vokabeln0.clear();
|
||||||
read a = new read();
|
read a = new read();
|
||||||
try {
|
try {
|
||||||
a.read();
|
a.read();
|
||||||
}
|
} catch (FileNotFoundException ex) {
|
||||||
catch (FileNotFoundException ex) {
|
|
||||||
System.out.println("Datei wird neu Angelegt!");
|
System.out.println("Datei wird neu Angelegt!");
|
||||||
}
|
} catch (IOException ex) {
|
||||||
catch (IOException ex) {
|
|
||||||
Logger.getLogger(GUI.class.getName()).log(Level.SEVERE, null, ex);
|
Logger.getLogger(GUI.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
}
|
}
|
||||||
this.jLabel5.setText(Integer.toString(richtig));
|
this.jLabel5.setText(Integer.toString(richtig));
|
||||||
this.jLabel6.setText(Integer.toString(falsch));
|
this.jLabel6.setText(Integer.toString(falsch));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @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 | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) {
|
|
||||||
java.util.logging.Logger.getLogger(GUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
|
||||||
}
|
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
/* Create and display the form */
|
|
||||||
java.awt.EventQueue.invokeLater(() -> {
|
|
||||||
new GUI().setVisible(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
|
private javax.swing.JButton jButton1;
|
||||||
|
private javax.swing.JButton jButton2;
|
||||||
|
private javax.swing.JButton jButton3;
|
||||||
|
private javax.swing.JButton jButton4;
|
||||||
|
private javax.swing.JButton jButton5;
|
||||||
|
private javax.swing.JLabel jLabel1;
|
||||||
|
private javax.swing.JLabel jLabel10;
|
||||||
|
private javax.swing.JLabel jLabel2;
|
||||||
|
private javax.swing.JLabel jLabel3;
|
||||||
|
private javax.swing.JLabel jLabel4;
|
||||||
|
private javax.swing.JLabel jLabel5;
|
||||||
|
private javax.swing.JLabel jLabel6;
|
||||||
|
private javax.swing.JLabel jLabel7;
|
||||||
|
private javax.swing.JLabel jLabel8;
|
||||||
|
private javax.swing.JLabel jLabel9;
|
||||||
|
private javax.swing.JMenu jMenu1;
|
||||||
|
private javax.swing.JMenu jMenu2;
|
||||||
|
private javax.swing.JMenuBar jMenuBar1;
|
||||||
|
private javax.swing.JMenuItem jMenuItem1;
|
||||||
|
private javax.swing.JTextField jTextField1;
|
||||||
|
private javax.swing.JTextField jTextField2;
|
||||||
// End of variables declaration//GEN-END:variables
|
// End of variables declaration//GEN-END:variables
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -26,8 +26,12 @@
|
||||||
<Group type="102" attributes="0">
|
<Group type="102" attributes="0">
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Component id="jScrollPane1" pref="376" max="32767" attributes="0"/>
|
<Group type="102" attributes="0">
|
||||||
<Component id="jButton1" max="32767" attributes="0"/>
|
<Component id="jButton1" min="-2" pref="213" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Component id="jButton2" pref="158" max="32767" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
<Component id="jScrollPane1" max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
|
@ -39,7 +43,10 @@
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="jScrollPane1" min="-2" pref="278" max="-2" attributes="0"/>
|
<Component id="jScrollPane1" min="-2" pref="278" max="-2" attributes="0"/>
|
||||||
<EmptySpace pref="7" max="32767" attributes="0"/>
|
<EmptySpace pref="7" max="32767" attributes="0"/>
|
||||||
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
|
<Group type="103" groupAlignment="3" attributes="0">
|
||||||
|
<Component id="jButton1" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
|
<Component id="jButton2" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
|
@ -73,5 +80,13 @@
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
|
||||||
</Events>
|
</Events>
|
||||||
</Component>
|
</Component>
|
||||||
|
<Component class="javax.swing.JButton" name="jButton2">
|
||||||
|
<Properties>
|
||||||
|
<Property name="text" type="java.lang.String" value="Remove"/>
|
||||||
|
</Properties>
|
||||||
|
<Events>
|
||||||
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton2ActionPerformed"/>
|
||||||
|
</Events>
|
||||||
|
</Component>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
</Form>
|
</Form>
|
||||||
|
|
|
@ -6,17 +6,29 @@
|
||||||
|
|
||||||
package vokabeltrainer;
|
package vokabeltrainer;
|
||||||
|
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
import javax.swing.DefaultListModel;
|
import javax.swing.DefaultListModel;
|
||||||
|
import readandwrite.readandremove;
|
||||||
|
import readandwrite.remove;
|
||||||
|
import readandwrite.write;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author simono41
|
* @author simono41
|
||||||
*/
|
*/
|
||||||
public class Vokabeln extends javax.swing.JFrame {
|
public final class Vokabeln extends javax.swing.JFrame {
|
||||||
|
|
||||||
|
private int position;
|
||||||
|
public static ArrayList<String> vokabeln0 = new ArrayList();
|
||||||
|
|
||||||
/** Creates new form Vokabeln */
|
/** Creates new form Vokabeln */
|
||||||
public Vokabeln() {
|
public Vokabeln() {
|
||||||
initComponents();
|
initComponents();
|
||||||
|
this.aktualisieren();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This method is called from within the constructor to
|
/** This method is called from within the constructor to
|
||||||
|
@ -31,6 +43,7 @@ public class Vokabeln extends javax.swing.JFrame {
|
||||||
jScrollPane1 = new javax.swing.JScrollPane();
|
jScrollPane1 = new javax.swing.JScrollPane();
|
||||||
jList1 = new javax.swing.JList<>();
|
jList1 = new javax.swing.JList<>();
|
||||||
jButton1 = new javax.swing.JButton();
|
jButton1 = new javax.swing.JButton();
|
||||||
|
jButton2 = new javax.swing.JButton();
|
||||||
|
|
||||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||||
|
|
||||||
|
@ -43,6 +56,13 @@ public class Vokabeln extends javax.swing.JFrame {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
jButton2.setText("Remove");
|
||||||
|
jButton2.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
jButton2ActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||||
getContentPane().setLayout(layout);
|
getContentPane().setLayout(layout);
|
||||||
layout.setHorizontalGroup(
|
layout.setHorizontalGroup(
|
||||||
|
@ -50,8 +70,11 @@ public class Vokabeln extends javax.swing.JFrame {
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addContainerGap()
|
.addContainerGap()
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 376, Short.MAX_VALUE)
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 213, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, 158, Short.MAX_VALUE))
|
||||||
|
.addComponent(jScrollPane1))
|
||||||
.addContainerGap())
|
.addContainerGap())
|
||||||
);
|
);
|
||||||
layout.setVerticalGroup(
|
layout.setVerticalGroup(
|
||||||
|
@ -60,7 +83,9 @@ public class Vokabeln extends javax.swing.JFrame {
|
||||||
.addContainerGap()
|
.addContainerGap()
|
||||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 278, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 278, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 7, Short.MAX_VALUE)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 7, Short.MAX_VALUE)
|
||||||
.addComponent(jButton1)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
|
.addComponent(jButton1)
|
||||||
|
.addComponent(jButton2))
|
||||||
.addContainerGap())
|
.addContainerGap())
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -69,44 +94,67 @@ public class Vokabeln extends javax.swing.JFrame {
|
||||||
|
|
||||||
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
|
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
|
||||||
// TODO add your handling code here:
|
// TODO add your handling code here:
|
||||||
DefaultListModel<String> dim = new DefaultListModel<>();
|
this.aktualisieren();
|
||||||
for (int i = 0; i < GUI.vokabeln0.size(); ++i) {
|
|
||||||
dim.addElement(GUI.vokabeln0.get(i) + " = " + GUI.vokabeln0.get(i++));
|
|
||||||
}
|
|
||||||
this.jList1.setModel(dim);
|
|
||||||
}//GEN-LAST:event_jButton1ActionPerformed
|
}//GEN-LAST:event_jButton1ActionPerformed
|
||||||
|
|
||||||
/**
|
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
|
||||||
* @param args the command line arguments
|
// TODO add your handling code here:
|
||||||
*/
|
this.entfernen();
|
||||||
public static void main(String args[]) {
|
}//GEN-LAST:event_jButton2ActionPerformed
|
||||||
/* Set the Nimbus look and feel */
|
|
||||||
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
|
public void entfernen() {
|
||||||
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
|
position = jList1.getSelectedIndex();
|
||||||
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
|
|
||||||
*/
|
System.out.println("Ausgewählt = " + jList1.getSelectedValue());
|
||||||
try {
|
System.out.println("Ausgewählt = " + position);
|
||||||
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
|
|
||||||
if ("Nimbus".equals(info.getName())) {
|
System.out.println(GUI.vokabeln0.get(position * 2));
|
||||||
javax.swing.UIManager.setLookAndFeel(info.getClassName());
|
|
||||||
break;
|
readandremove d = new readandremove();
|
||||||
}
|
|
||||||
}
|
vokabeln0.clear();
|
||||||
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) {
|
try {
|
||||||
java.util.logging.Logger.getLogger(Vokabeln.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
d.read();
|
||||||
}
|
} catch (FileNotFoundException ex) {
|
||||||
//</editor-fold>
|
System.out.println("Datei wird neu Angelegt!");
|
||||||
|
} catch (IOException ex) {
|
||||||
|
Logger.getLogger(GUI.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
vokabeln0.add(GUI.vokabeln0.get(position * 2));
|
||||||
|
vokabeln0.add(GUI.vokabeln0.get(position * 2 + 1));
|
||||||
|
|
||||||
|
remove c = new remove();
|
||||||
|
try {
|
||||||
|
c.write();
|
||||||
|
} catch (IOException ex) {
|
||||||
|
Logger.getLogger(Vokabeln.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
GUI.vokabeln0.remove(position * 2);
|
||||||
|
GUI.vokabeln0.remove(position * 2);
|
||||||
|
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
/* Create and display the form */
|
this.aktualisieren();
|
||||||
java.awt.EventQueue.invokeLater(() -> {
|
write b = new write();
|
||||||
new Vokabeln().setVisible(true);
|
try {
|
||||||
});
|
b.write();
|
||||||
|
} catch (IOException ex) {
|
||||||
|
Logger.getLogger(Vokabeln.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
|
}
|
||||||
|
GUI a = new GUI();
|
||||||
|
a.aktualisieren();
|
||||||
|
}
|
||||||
|
public void aktualisieren() {
|
||||||
|
DefaultListModel<String> dim = new DefaultListModel<>();
|
||||||
|
for (int i = 0; i < GUI.vokabeln0.size();) {
|
||||||
|
dim.addElement(GUI.vokabeln0.get(i++) + " = " + GUI.vokabeln0.get(i++));
|
||||||
|
}
|
||||||
|
this.jList1.setModel(dim);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
private javax.swing.JButton jButton1;
|
private javax.swing.JButton jButton1;
|
||||||
|
private javax.swing.JButton jButton2;
|
||||||
private javax.swing.JList<String> jList1;
|
private javax.swing.JList<String> jList1;
|
||||||
private javax.swing.JScrollPane jScrollPane1;
|
private javax.swing.JScrollPane jScrollPane1;
|
||||||
// End of variables declaration//GEN-END:variables
|
// End of variables declaration//GEN-END:variables
|
||||||
|
|
Loading…
Add table
Reference in a new issue