Browse Source

Tage_D Zufallsgenerator erstellt.

new_repo
Hauch IT 5 years ago
parent
commit
b7f3ddf08a
  1. 85
      .idea/workspace.xml
  2. 6
      src/Main.java
  3. 62
      src/Tage_D.java

85
.idea/workspace.xml

@ -1,14 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="41dc023d-0769-466f-850a-8e3eed9fe5fa" name="Default Changelist" comment="Entwicklung eines ButtonGroup Aktoren und der Verwendung der Klassen Quiz und Tage">
<change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
<list default="true" id="41dc023d-0769-466f-850a-8e3eed9fe5fa" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Main.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Main.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Quiz_Spiel.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Quiz_Spiel.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Tage_D.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Tage_D.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/bild.gif" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/pic.jpg" beforeDir="false" />
</list>
<ignored path="$PROJECT_DIR$/out/" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
@ -22,11 +18,11 @@
</component>
<component name="FileEditorManager">
<leaf>
<file pinned="false" current-in-tab="true">
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="187">
<caret line="105" column="34" selection-start-line="105" selection-start-column="34" selection-end-line="105" selection-end-column="34" />
<state relative-caret-position="-26">
<caret line="75" column="82" selection-start-line="75" selection-start-column="82" selection-end-line="75" selection-end-column="82" />
<folding>
<element signature="imports" expanded="true" />
</folding>
@ -34,28 +30,13 @@
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/Quiz_Spiel.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="93">
<caret line="159" column="1" lean-forward="true" selection-start-line="159" selection-start-column="1" selection-end-line="163" selection-end-column="22" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/Tage_D.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="804">
<caret line="52" column="51" selection-start-line="52" selection-start-column="51" selection-end-line="52" selection-end-column="51" />
<state relative-caret-position="323">
<caret line="122" lean-forward="true" selection-start-line="122" selection-end-line="122" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#3538#3539#0" expanded="true" />
<element signature="e#3591#3592#0" expanded="true" />
<element signature="e#3716#3717#0" expanded="true" />
<element signature="e#3771#3772#0" expanded="true" />
<element signature="e#3897#3898#0" expanded="true" />
<element signature="e#3952#3953#0" expanded="true" />
</folding>
</state>
</provider>
@ -101,9 +82,9 @@
<option value="$PROJECT_DIR$/src/Geburtstag.java" />
<option value="$PROJECT_DIR$/src/MainGUI.form" />
<option value="$PROJECT_DIR$/src/Tage_DTest.java" />
<option value="$PROJECT_DIR$/src/Tage_D.java" />
<option value="$PROJECT_DIR$/src/Quiz_Spiel.java" />
<option value="$PROJECT_DIR$/src/Main.java" />
<option value="$PROJECT_DIR$/src/Tage_D.java" />
</list>
</option>
</component>
@ -252,7 +233,7 @@
<workItem from="1562781684319" duration="923000" />
<workItem from="1562789348995" duration="2654000" />
<workItem from="1562848572975" duration="6651000" />
<workItem from="1562856644601" duration="6634000" />
<workItem from="1562856644601" duration="8551000" />
</task>
<task id="LOCAL-00001" summary="neue master">
<created>1562341097724</created>
@ -380,17 +361,24 @@
<option name="project" value="LOCAL" />
<updated>1562861654490</updated>
</task>
<option name="localTasksCounter" value="19" />
<task id="LOCAL-00019" summary="Verbesserung Main und Erweiterung Tage_D">
<created>1562864535253</created>
<option name="number" value="00019" />
<option name="presentableId" value="LOCAL-00019" />
<option name="project" value="LOCAL" />
<updated>1562864535253</updated>
</task>
<option name="localTasksCounter" value="20" />
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="29411000" />
<option name="totallyTimeSpent" value="31328000" />
</component>
<component name="ToolWindowManager">
<frame x="-8" y="-8" width="1616" height="886" extended-state="6" />
<editor active="true" />
<layout>
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.14203085" />
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.14203085" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info id="Image Layers" order="2" />
<window_info id="Designer" order="3" />
@ -400,7 +388,7 @@
<window_info anchor="bottom" id="Messages" order="0" weight="0.32802126" />
<window_info anchor="bottom" id="Message" order="1" />
<window_info anchor="bottom" id="Find" order="2" />
<window_info anchor="bottom" id="Run" order="3" visible="true" weight="0.33466136" />
<window_info active="true" anchor="bottom" id="Run" order="3" visible="true" weight="0.33466136" />
<window_info anchor="bottom" id="Debug" order="4" weight="0.3997344" />
<window_info anchor="bottom" id="Cvs" order="5" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="6" weight="0.4" />
@ -435,7 +423,8 @@
<MESSAGE value="Junit für Tage_D erzeugt" />
<MESSAGE value="Main Menü angepasst mit Auswahl und Action Listener erstellt. So das Unterklassen Objekte erzeugt werden" />
<MESSAGE value="Entwicklung eines ButtonGroup Aktoren und der Verwendung der Klassen Quiz und Tage" />
<option name="LAST_COMMIT_MESSAGE" value="Entwicklung eines ButtonGroup Aktoren und der Verwendung der Klassen Quiz und Tage" />
<MESSAGE value="Verbesserung Main und Erweiterung Tage_D" />
<option name="LAST_COMMIT_MESSAGE" value="Verbesserung Main und Erweiterung Tage_D" />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/src/testJFrame.java" />
@ -499,22 +488,6 @@
<entry file="file://$PROJECT_DIR$/src/bild2.jpg">
<provider selected="true" editor-type-id="images" />
</entry>
<entry file="file://$PROJECT_DIR$/src/Tage_D.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="804">
<caret line="52" column="51" selection-start-line="52" selection-start-column="51" selection-end-line="52" selection-end-column="51" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#3538#3539#0" expanded="true" />
<element signature="e#3591#3592#0" expanded="true" />
<element signature="e#3716#3717#0" expanded="true" />
<element signature="e#3771#3772#0" expanded="true" />
<element signature="e#3897#3898#0" expanded="true" />
<element signature="e#3952#3953#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Quiz_Spiel.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="93">
@ -524,8 +497,18 @@
</entry>
<entry file="file://$PROJECT_DIR$/src/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="187">
<caret line="105" column="34" selection-start-line="105" selection-start-column="34" selection-end-line="105" selection-end-column="34" />
<state relative-caret-position="-26">
<caret line="75" column="82" selection-start-line="75" selection-start-column="82" selection-end-line="75" selection-end-column="82" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Tage_D.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="323">
<caret line="122" lean-forward="true" selection-start-line="122" selection-end-line="122" />
<folding>
<element signature="imports" expanded="true" />
</folding>

6
src/Main.java

@ -67,13 +67,13 @@ public class Main {
ButtonGroup buttonGroup = new ButtonGroup();
JButton DTools = new JButton("Daniel"); DTools.setBounds(100, 100, 100, 20);
JButton DTools = new JButton("Daniel"); DTools.setBounds(100, 100, 100, 40);
buttonGroup.add(DTools); Panele.add(DTools);
JButton ETools = new JButton("Eugen"); ETools.setBounds(200, 200, 100, 20);
JButton ETools = new JButton("Eugen"); ETools.setBounds(200, 200, 100, 40);
buttonGroup.add(ETools); Panele.add(ETools);
JButton MTools = new JButton("Michael"); MTools.setBounds(300, 300, 100, 20);
JButton MTools = new JButton("Michael"); MTools.setBounds(300, 300, 100, 40);
buttonGroup.add(MTools); Panele.add(MTools);
DTools.addActionListener(new ActionListener() {

62
src/Tage_D.java

@ -5,7 +5,7 @@ import javax.swing.JOptionPane;
import javax.swing.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.concurrent.ThreadLocalRandom;
import java.util.Random;
public class Tage_D extends JFrame {
@ -20,6 +20,8 @@ public class Tage_D extends JFrame {
JTextField j2 = null;
JTextField j3 = null;
JTextField j4 = null;
JTextField j5 = null;
JTextField j6 = null;
JMenuItem menuItem1 = null;
@ -33,7 +35,7 @@ public class Tage_D extends JFrame {
public Tage_D() {
fr = new JFrame("Coutinius Integration SS 2019");
fr.setSize(600,800);
fr.setSize(500,500);
fr.setFont(new Font("Helvetica", Font.PLAIN, 12));
fr.setLayout(new FlowLayout());
@ -81,48 +83,54 @@ public class Tage_D extends JFrame {
*/
j1 = new JTextField("Tools von Daniel Hauch"); j1.setEditable(false); j1.setSize(450,30); ; Panele.add(j1);
j2 = new JTextField("Wie ist Ihr Name?"); j2.setEditable(false); Panele.add(j2); j2.setSize(450,30); Panele.add(j2);
j3 = new JTextField(""); j3.setEditable(true); Panele.add(j2); j3.setSize(450,30); Panele.add(j3);
button1 = new JButton("Erfahren"); Panele.add(button1);
j4 = new JTextField("Sie sterben in ___ Jahren!"); Panele.add(j4);
j2 = new JTextField("Geben Sie hier jeweils nach Auswahl: Geburtsjahr, Hohchzeitsjahr, aktuelles Jahr ein!"); j2.setEditable(false); Panele.add(j2); j2.setSize(450,30); Panele.add(j2);
j3 = new JTextField("Bsp. 1966"); j3.setEditable(true); Panele.add(j2); j3.setSize(450,30); Panele.add(j3);
j4 = new JTextField("Hier erfahren Sie Ergebnisse aus Ihrer Auswahl"); Panele.add(j4);
ButtonGroup buttonGroup = new ButtonGroup();
JButton szeit= new JButton("Sterbezeitpunkt");
JButton szeit= new JButton("Sterbezeitpunkt Erfahren");
szeit.setBounds(100, 170, 100, 20);
buttonGroup.add(szeit); Panele.add(szeit);
JButton gtag = new JButton("zufällige Alter ausrechnen");
gtag.setBounds(250, 170, 100, 20);
buttonGroup.add(gtag); Panele.add(gtag);
JLabel auswahl = new JLabel("Ihre Auswahl:");
auswahl.setBounds(10, 200, 100, 20);
Panele.add(auswahl);
final JTextField text1 = new JTextField("");
text1.setBounds(100, 200, 300, 20);
Panele.add(text1);
szeit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ie) {
text1.setText("MALE");
}
});
gtag.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ie) {
text1.setText("FEMALE");
Random randomGenerator = new Random();
int randomInt = randomGenerator.nextInt(50) + 1;
int zahl = Integer.parseInt(j3.getText());
int zufall = zahl + randomInt;
String resultat = new String("Sie werden im Jahr: "+zufall+" möglicherweise sterben!");
j4.setText(resultat);
}
});
JButton gtag = new JButton("zufälliges Alter ausrechnen");
gtag.setBounds(250, 170, 100, 20);
buttonGroup.add(gtag); Panele.add(gtag);
gtag.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ie) {
text1.setText("FEMALE");
Random randomGenerator = new Random();
int randomInt = randomGenerator.nextInt(50) + 1;
int zahl = Integer.parseInt(j3.getText());
int zufall = zahl + randomInt;
String resultat = new String("Sie werden in "+zufall+" Jahren möglicherweise sterben!");
j4.setText(resultat);
}
});
final JTextField text1 = new JTextField("");
text1.setBounds(100, 200, 300, 20);
Panele.add(text1);
fr.setVisible(true);
fr.setAlwaysOnTop(true);
fr.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

Loading…
Cancel
Save