Browse Source

Tage_D neue Desing und Anpassung Felder und neue Actionlistener

new_repo
Hauch IT 6 years ago
parent
commit
ee2c489c0c
  1. 59
      .idea/workspace.xml
  2. 16
      src/Main.java
  3. 101
      src/Tage_D.java

59
.idea/workspace.xml

@ -2,8 +2,8 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="41dc023d-0769-466f-850a-8e3eed9fe5fa" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
<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/Tage_D.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Tage_D.java" afterDir="false" />
</list>
<ignored path="$PROJECT_DIR$/out/" />
@ -18,25 +18,29 @@
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file pinned="false" current-in-tab="false">
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1207">
<caret line="75" column="82" selection-start-line="75" selection-start-column="82" selection-end-line="75" selection-end-column="82" />
<state relative-caret-position="76">
<caret line="23" column="30" selection-start-line="23" selection-start-column="30" selection-end-line="23" selection-end-column="30" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#1860#1993#0" expanded="true" />
<element signature="e#1992#1993#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/Tage_D.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="85">
<caret line="101" lean-forward="true" selection-start-line="101" selection-end-line="101" />
<state relative-caret-position="100">
<caret line="35" column="8" lean-forward="true" selection-start-line="35" selection-start-column="8" selection-end-line="35" selection-end-column="30" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#1920#2053#0" expanded="true" />
<element signature="e#2052#2053#0" expanded="true" />
</folding>
</state>
</provider>
@ -83,8 +87,8 @@
<option value="$PROJECT_DIR$/src/MainGUI.form" />
<option value="$PROJECT_DIR$/src/Tage_DTest.java" />
<option value="$PROJECT_DIR$/src/Quiz_Spiel.java" />
<option value="$PROJECT_DIR$/src/Main.java" />
<option value="$PROJECT_DIR$/src/Tage_D.java" />
<option value="$PROJECT_DIR$/src/Main.java" />
</list>
</option>
</component>
@ -101,8 +105,6 @@
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scope" />
<pane id="PackagesPane" />
<pane id="ProjectPane">
<subPane>
<expand>
@ -124,6 +126,8 @@
<select />
</subPane>
</pane>
<pane id="Scope" />
<pane id="PackagesPane" />
</panes>
</component>
<component name="PropertiesComponent">
@ -228,7 +232,8 @@
<workItem from="1562789348995" duration="2654000" />
<workItem from="1562848572975" duration="6651000" />
<workItem from="1562856644601" duration="8772000" />
<workItem from="1562929796678" duration="3640000" />
<workItem from="1562929796678" duration="3793000" />
<workItem from="1563047167511" duration="5798000" />
</task>
<task id="LOCAL-00001" summary="neue master">
<created>1562341097724</created>
@ -370,17 +375,24 @@
<option name="project" value="LOCAL" />
<updated>1562866562782</updated>
</task>
<option name="localTasksCounter" value="21" />
<task id="LOCAL-00021" summary="Tage_D Zufallsgenerator erstellt.">
<created>1562934759261</created>
<option name="number" value="00021" />
<option name="presentableId" value="LOCAL-00021" />
<option name="project" value="LOCAL" />
<updated>1562934759261</updated>
</task>
<option name="localTasksCounter" value="22" />
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="35189000" />
<option name="totallyTimeSpent" value="41140000" />
</component>
<component name="ToolWindowManager">
<frame x="-8" y="-8" width="1616" height="886" extended-state="6" />
<editor active="true" />
<layout>
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.14395887" />
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.14588688" />
<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" />
@ -427,7 +439,8 @@
<MESSAGE value="Entwicklung eines ButtonGroup Aktoren und der Verwendung der Klassen Quiz und Tage" />
<MESSAGE value="Verbesserung Main und Erweiterung Tage_D" />
<MESSAGE value="Tage_D Zufallsgenerator erstellt." />
<option name="LAST_COMMIT_MESSAGE" value="Tage_D Zufallsgenerator erstellt." />
<MESSAGE value="Tage_D Generator angepasst mit Zeitpunkt Änderung größer dieses Jahres" />
<option name="LAST_COMMIT_MESSAGE" value="Tage_D Generator angepasst mit Zeitpunkt Änderung größer dieses Jahres" />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/src/testJFrame.java" />
@ -494,22 +507,26 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Main.java">
<entry file="file://$PROJECT_DIR$/src/Tage_D.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1207">
<caret line="75" column="82" selection-start-line="75" selection-start-column="82" selection-end-line="75" selection-end-column="82" />
<state relative-caret-position="100">
<caret line="35" column="8" lean-forward="true" selection-start-line="35" selection-start-column="8" selection-end-line="35" selection-end-column="30" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#1920#2053#0" expanded="true" />
<element signature="e#2052#2053#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Tage_D.java">
<entry file="file://$PROJECT_DIR$/src/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="85">
<caret line="101" lean-forward="true" selection-start-line="101" selection-end-line="101" />
<state relative-caret-position="76">
<caret line="23" column="30" selection-start-line="23" selection-start-column="30" selection-end-line="23" selection-end-column="30" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#1860#1993#0" expanded="true" />
<element signature="e#1992#1993#0" expanded="true" />
</folding>
</state>
</provider>

16
src/Main.java

@ -21,7 +21,7 @@ public class Main {
public Main(){
fr = new JFrame("Coutinius Integration SS 2019");
fr.setSize(400,400);
fr.setSize(1920,1080);
fr.setFont(new Font("Helvetica", Font.PLAIN, 12));
fr.setLayout(new FlowLayout());
@ -41,6 +41,18 @@ public class Main {
menuItem1 = new JMenuItem("Exit"); mF.add(menuItem1);
menuItem2 = new JMenuItem("Über"); mI.add(menuItem2);
menuItem1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ie) {
try {
System.exit(-1);
}catch (Exception ex) {
JOptionPane.showMessageDialog(null, "Fehler");
}
}
});
menuItem2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ie) {
try {
@ -59,8 +71,6 @@ public class Main {
}
});
fr.setContentPane(Panele);
Panele.add(new JLabel("CI Tools von "));

101
src/Tage_D.java

@ -11,7 +11,6 @@ import java.util.Date;
public class Tage_D extends JFrame {
Icon icon1,icon2,icon3;
JLabel bild1,bild2,bild3;
JFrame fr = null;
@ -23,8 +22,6 @@ public class Tage_D extends JFrame {
JTextField j4 = null;
JTextField j5 = null;
JTextField j6 = null;
JMenuItem menuItem1 = null;
JMenuItem menuItem2 = null;
JMenuBar bar =null;
@ -33,11 +30,10 @@ public class Tage_D extends JFrame {
JMenu mI = null;
Date datum = null;
public Tage_D() {
fr = new JFrame("Coutinius Integration SS 2019");
fr.setSize(500,500);
fr.setSize(1920,1080);
fr.setFont(new Font("Helvetica", Font.PLAIN, 12));
fr.setLayout(new FlowLayout());
@ -45,8 +41,6 @@ public class Tage_D extends JFrame {
fr.setContentPane(Panele);
Date datum=new Date();
int year=datum.getYear() + 1900;
bar = new JMenuBar();
fr.setJMenuBar(bar);
@ -60,6 +54,17 @@ public class Tage_D extends JFrame {
menuItem1 = new JMenuItem("Exit"); mF.add(menuItem1);
menuItem2 = new JMenuItem("Über"); mI.add(menuItem2);
menuItem1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ie) {
try {
System.exit(-1);
}catch (Exception ex) {
JOptionPane.showMessageDialog(null, "Fehler");
}
}
});
menuItem2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ie) {
@ -79,7 +84,10 @@ public class Tage_D extends JFrame {
}
});
fr.setContentPane(Panele);
Date datum=new Date();
int year=datum.getYear() + 1900;
/*
icon1 = new ImageIcon(getClass().getResource("bild1.jpg")); bild1 = new JLabel(icon1); fr.add(icon1);
@ -87,10 +95,10 @@ public class Tage_D extends JFrame {
icon3 = new ImageIcon(getClass().getResource("bild3.gif")); bild3 = new JLabel(icon3); fr.add(icon3);
*/
j1 = new JTextField("Tools von Daniel Hauch"); j1.setEditable(false); j1.setSize(450,30); ; Panele.add(j1);
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);
j1 = new JTextField("Tools von Daniel Hauch"); j1.setEditable(false); j1.setSize(450,30); ; bar.add(j1);
j2 = new JTextField("Geben Sie hier jeweils nach Auswahl: Geburtsjahr, Hohchzeitsjahr, aktuelles Jahr ein! Bsp. 1969"); j2.setEditable(false); Panele.add(j2); j2.setSize(450,30); Panele.add(j2);
j3 = new JTextField("1969"); j3.setEditable(true); Panele.add(j2); j3.setSize(450,30); Panele.add(j3);
ButtonGroup buttonGroup = new ButtonGroup();
JButton szeit= new JButton("Sterbezeitpunkt Erfahren");
@ -100,68 +108,61 @@ public class Tage_D extends JFrame {
szeit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ie) {
Random randomGenerator = new Random();
int randomInt = randomGenerator.nextInt(50) + 1;
int zahl = Integer.parseInt(j3.getText());
int zufall = zahl + randomInt;
if(zufall<=year){
zufall = zahl + randomInt;
int ergebnis, zufall, zahl, i;
zahl = Integer.parseInt(j3.getText());
String resultat = new String("Sie werden in "+zufall+" Jahren möglicherweise sterben!");
j4.setText(resultat);
zufall= gibZufall(zahl);
}else{
while(zufall<=year){
// System.out.println(zufall);
String resultat = new String("Sie werden in "+zufall+" Jahren möglicherweise sterben!");
j4.setText(resultat);
zufall = gibZufall(zahl);
}
String resultat = new String("Sie werden im Jahre "+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) {
Random randomGenerator = new Random();
int randomInt = randomGenerator.nextInt(50) + 1;
int zahl = Integer.parseInt(j3.getText());
int zufall = zahl + randomInt;
if(zufall<=year){
JButton htag = new JButton("Silber-Gold-Diamant ausrechnen");
htag.setBounds(250, 170, 100, 20);
buttonGroup.add(htag); Panele.add(htag);
String resultat = new String("Sie werden in "+zufall+" Jahren möglicherweise sterben!");
j4.setText(resultat);
htag.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ie) {
}else{
String resultat = new String("Test in "+zufall+" Jahren möglicherweise sterben!");
j4.setText(resultat);
int diamant, gold, silber, zufall, zahl, i;
}
zahl = Integer.parseInt(j3.getText());
diamant=zahl+60;
gold=zahl+50;
silber=zahl+25;
String resultat = new String("Sie werden im Jahr "+silber+" Ihre Silberhochzeit, im Jahr "+gold+" Ihre Goldene Hochzeit und im Jahr "+diamant+" Diamanten Hochzeit feiern.");
j4.setText(resultat);
}
});
final JTextField text1 = new JTextField("");
text1.setBounds(100, 200, 300, 20);
Panele.add(text1);
j4 = new JTextField("Hier erfahren Sie Ergebnisse aus Ihrer Auswahl"); Panele.add(j4);
fr.setVisible(true);
fr.setAlwaysOnTop(true);
fr.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
//Methode gibt eine ganze Zahl (int) zurück
public static int gibZufall (int zahl) {
Random randomGenerator = new Random();
int randomInt = randomGenerator.nextInt(115) + 1;
int zufall = zahl + randomInt;
return zufall;
}
}
Loading…
Cancel
Save