diff --git a/.idea/misc.xml b/.idea/misc.xml
index e0844bc..0548357 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index ead72f5..661802f 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -2,8 +2,8 @@
+
-
@@ -17,11 +17,11 @@
-
+
-
+
@@ -33,8 +33,8 @@
-
-
+
+
@@ -120,12 +120,6 @@
-
-
-
-
-
-
@@ -233,7 +227,8 @@
-
+
+
1562341097724
@@ -368,17 +363,24 @@
1562864535253
-
+
+ 1562866562782
+
+
+
+ 1562866562782
+
+
-
+
-
+
@@ -424,7 +426,8 @@
-
+
+
@@ -476,12 +479,8 @@
-
-
-
-
-
-
+
+
@@ -497,7 +496,7 @@
-
+
@@ -507,8 +506,8 @@
-
-
+
+
@@ -570,7 +569,6 @@
diff --git a/src/Tage_D.java b/src/Tage_D.java
index 22969ad..2dc12a9 100644
--- a/src/Tage_D.java
+++ b/src/Tage_D.java
@@ -6,6 +6,7 @@ import javax.swing.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.Random;
+import java.util.Date;
public class Tage_D extends JFrame {
@@ -30,6 +31,7 @@ public class Tage_D extends JFrame {
JMenu mF= null;
JMenu mH = null;
JMenu mI = null;
+ Date datum = null;
public Tage_D() {
@@ -43,6 +45,9 @@ public class Tage_D extends JFrame {
fr.setContentPane(Panele);
+ Date datum=new Date();
+ int year=datum.getYear() + 1900;
+
bar = new JMenuBar();
fr.setJMenuBar(bar);
mF = new JMenu("File");
@@ -100,9 +105,20 @@ public class Tage_D extends JFrame {
int zahl = Integer.parseInt(j3.getText());
int zufall = zahl + randomInt;
- String resultat = new String("Sie werden im Jahr: "+zufall+" möglicherweise sterben!");
+ if(zufall<=year){
+ zufall = zahl + randomInt;
+
+
+ String resultat = new String("Sie werden in "+zufall+" Jahren möglicherweise sterben!");
+ j4.setText(resultat);
+
+ }else{
+
+ String resultat = new String("Sie werden in "+zufall+" Jahren möglicherweise sterben!");
+ j4.setText(resultat);
+ }
+
- j4.setText(resultat);
}
});
@@ -119,9 +135,18 @@ public class Tage_D extends JFrame {
int zahl = Integer.parseInt(j3.getText());
int zufall = zahl + randomInt;
- String resultat = new String("Sie werden in "+zufall+" Jahren möglicherweise sterben!");
+ if(zufall<=year){
+
+ String resultat = new String("Sie werden in "+zufall+" Jahren möglicherweise sterben!");
+ j4.setText(resultat);
+
+ }else{
+ String resultat = new String("Test in "+zufall+" Jahren möglicherweise sterben!");
+ j4.setText(resultat);
+
+ }
+
- j4.setText(resultat);
}
});