Browse Source

Main Menü angepasst mit Auswahl und Action Listener erstellt. So das Unterklassen Objekte erzeugt werden

new_repo
Hauch IT 2 years ago
parent
commit
d666adc762
  1. 124
      .idea/workspace.xml
  2. 12
      JunitTest/JunitTest.iml
  3. 2
      src/D_Test2.java
  4. 2
      src/D_Test3.java
  5. 123
      src/Main.java
  6. 28
      src/MainGUI.form
  7. 5
      src/MainGUI.java
  8. 28
      src/Tage_D.java

124
.idea/workspace.xml

@ -2,9 +2,14 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="41dc023d-0769-466f-850a-8e3eed9fe5fa" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/modules.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/modules.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/JunitTest/JunitTest.iml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Tage_DTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/JunitTest/src/Tage_DTest.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/D_Test2.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/D_Test3.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/Main.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Main.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/MainGUI.form" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/MainGUI.java" beforeDir="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/" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
@ -18,14 +23,18 @@
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/MainGUI.java">
<provider selected="true" editor-type-id="text-editor" />
</entry>
</file>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/MainGUI.form">
<provider selected="true" editor-type-id="ui-designer" />
<entry file="file://$PROJECT_DIR$/src/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="202">
<caret line="54" column="36" selection-start-line="54" selection-start-column="36" selection-end-line="54" selection-end-column="36" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#1181#1313#0" expanded="true" />
<element signature="e#1312#1313#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
</leaf>
@ -42,12 +51,14 @@
<findStrings>
<find>pa.</find>
<find>contantPane</find>
<find>ETools</find>
<find>this.</find>
</findStrings>
<replaceStrings>
<replace>this.</replace>
<replace>this.panel</replace>
<replace>Panele</replace>
<replace>MTools</replace>
</replaceStrings>
</component>
<component name="Git.Settings">
@ -60,10 +71,10 @@
<option value="$PROJECT_DIR$/src/fenster.java" />
<option value="$PROJECT_DIR$/src/geburtstag.java" />
<option value="$PROJECT_DIR$/src/Geburtstag.java" />
<option value="$PROJECT_DIR$/src/Main.java" />
<option value="$PROJECT_DIR$/src/MainGUI.form" />
<option value="$PROJECT_DIR$/src/Tage_D.java" />
<option value="$PROJECT_DIR$/src/Tage_DTest.java" />
<option value="$PROJECT_DIR$/src/Tage_D.java" />
<option value="$PROJECT_DIR$/src/Main.java" />
</list>
</option>
</component>
@ -80,8 +91,6 @@
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="PackagesPane" />
<pane id="Scope" />
<pane id="ProjectPane">
<subPane>
<expand>
@ -103,6 +112,8 @@
<select />
</subPane>
</pane>
<pane id="Scope" />
<pane id="PackagesPane" />
</panes>
</component>
<component name="PropertiesComponent">
@ -116,6 +127,7 @@
<property name="project.structure.proportion" value="0.15" />
<property name="project.structure.side.proportion" value="0.0" />
<property name="restartRequiresConfirmation" value="false" />
<property name="settings.editor.selected.configurable" value="preferences.lookFeel" />
</component>
<component name="RecentsManager">
<key name="CreateTestDialog.RecentsKey">
@ -137,7 +149,7 @@
</list>
</option>
</component>
<component name="RunManager" selected="Application.Tage_D">
<component name="RunManager" selected="Application.Main">
<configuration name="D_Geburtstag" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="D_Geburtstag" />
<module name="Alpha" />
@ -175,8 +187,8 @@
</configuration>
<recent_temporary>
<list>
<item itemvalue="Application.Tage_D" />
<item itemvalue="Application.Main" />
<item itemvalue="Application.Tage_D" />
<item itemvalue="Application.D_Test1" />
<item itemvalue="Application.D_Geburtstag" />
<item itemvalue="Application.main" />
@ -202,7 +214,8 @@
<workItem from="1562534024971" duration="213000" />
<workItem from="1562718828390" duration="103000" />
<workItem from="1562781684319" duration="923000" />
<workItem from="1562789348995" duration="2632000" />
<workItem from="1562789348995" duration="2654000" />
<workItem from="1562848572975" duration="3638000" />
</task>
<task id="LOCAL-00001" summary="neue master">
<created>1562341097724</created>
@ -309,27 +322,34 @@
<option name="project" value="LOCAL" />
<updated>1562804519991</updated>
</task>
<option name="localTasksCounter" value="16" />
<task id="LOCAL-00016" summary="Junit für Tage_D erzeugt">
<created>1562804715949</created>
<option name="number" value="00016" />
<option name="presentableId" value="LOCAL-00016" />
<option name="project" value="LOCAL" />
<updated>1562804715949</updated>
</task>
<option name="localTasksCounter" value="17" />
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="16104000" />
<option name="totallyTimeSpent" value="19764000" />
</component>
<component name="ToolWindowManager">
<frame x="-8" y="-8" width="1936" height="1066" extended-state="6" />
<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.11247335" />
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.113753214" />
<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" />
<window_info id="UI Designer" order="4" />
<window_info id="Capture Tool" order="5" />
<window_info id="Favorites" order="6" side_tool="true" />
<window_info anchor="bottom" id="Messages" order="0" weight="0.3290461" />
<window_info active="true" anchor="bottom" id="Messages" order="0" visible="true" 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" weight="0.33118972" />
<window_info anchor="bottom" id="Run" order="3" weight="0.3306773" />
<window_info anchor="bottom" id="Debug" order="4" weight="0.39978564" />
<window_info anchor="bottom" id="Cvs" order="5" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="6" weight="0.4" />
@ -386,48 +406,62 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/D_Geburtstag.java" />
<entry file="file://$PROJECT_DIR$/src/Quiz_E.java" />
<entry file="file://$PROJECT_DIR$/src/MainGUI.java">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/src/MainGUI.form">
<provider selected="true" editor-type-id="ui-designer" />
</entry>
<entry file="file://$PROJECT_DIR$/src/D_Test2.java">
<provider selected="true" editor-type-id="text-editor">
<state>
<caret column="13" selection-start-column="13" selection-end-column="13" />
<state relative-caret-position="34">
<caret line="2" lean-forward="true" selection-start-line="2" selection-end-line="2" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/D_Geburtstag.java" />
<entry file="file://$PROJECT_DIR$/src/Quiz_E.java" />
<entry file="file://$PROJECT_DIR$/src/Main.java">
<entry file="file://$PROJECT_DIR$/src/D_Test3.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="473">
<caret line="99" column="1" selection-start-line="99" selection-start-column="1" selection-end-line="99" selection-end-column="1" />
<state relative-caret-position="17">
<caret line="1" column="1" lean-forward="true" selection-start-line="1" selection-start-column="1" selection-end-line="1" selection-end-column="1" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Tage_D.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1275">
<caret line="79" column="55" lean-forward="true" selection-start-line="79" selection-start-column="55" selection-end-line="79" selection-end-column="55" />
<folding>
<element signature="e#1760#1761#0" expanded="true" />
<element signature="e#1813#1814#0" expanded="true" />
<element signature="e#1938#1939#0" expanded="true" />
<element signature="e#1993#1994#0" expanded="true" />
<element signature="e#2602#2603#0" expanded="true" />
<element signature="e#2655#2656#0" expanded="true" />
<element signature="e#2780#2781#0" expanded="true" />
<element signature="e#2835#2836#0" expanded="true" />
<element signature="e#2961#2962#0" expanded="true" />
<element signature="e#3016#3017#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/MainGUI.java">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/JunitTest/src/Tage_DTest.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="136">
<caret line="15" column="25" lean-forward="true" selection-start-line="15" selection-start-column="25" selection-end-line="15" selection-end-column="25" />
<state relative-caret-position="85">
<caret line="5" column="23" selection-start-line="5" selection-start-column="23" selection-end-line="5" selection-end-column="23" />
</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="17">
<caret line="5" column="33" selection-start-line="5" selection-start-column="33" selection-end-line="5" selection-end-column="33" />
<state relative-caret-position="202">
<caret line="54" column="36" selection-start-line="54" selection-start-column="36" selection-end-line="54" selection-end-column="36" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#1181#1313#0" expanded="true" />
<element signature="e#1312#1313#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/MainGUI.form">
<provider selected="true" editor-type-id="ui-designer" />
</entry>
</component>
<component name="masterDetails">
<states>
@ -478,10 +512,12 @@
</state>
<state key="ModuleStructureConfigurable.UI">
<settings>
<last-edited>JunitTest</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
<option value="0.6" />
</list>
</option>
</splitter-proportions>

12
JunitTest/JunitTest.iml

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: Arquillian JUnit:Release" level="project" />
</component>
</module>

2
src/D_Test2.java

@ -1,2 +0,0 @@
public class D_Test2 {
}

2
src/D_Test3.java

@ -1,2 +0,0 @@
public class D_Test3 {
}

123
src/Main.java

@ -1,6 +1,6 @@
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.*;
import java.awt.event.*;
public class Main {
//Variablen GUI
@ -11,90 +11,105 @@ public class Main {
JPanel contantPane = null;
JLabel label = null;
JMenuItem jmI = null;
JComboBox combobox_1;
//Konstruktor Gui
public Main(){
this.fr = new JFrame("Coutinius Integration");
this.fr.setSize(666,900);
this.jmb = new JMenuBar();
this.fr.setJMenuBar(jmb);
this.jm = new JMenu("Menu");
this.jmb.add(jm);
this.jmI = new JMenuItem("Exit");
this.jm.add(jmI);
this.jmI.addActionListener(new ActionListener1());
this.jm1 = new JMenu("Info");
this.jmb.add(jm1);
fr = new JFrame("Coutinius Integration SS 2019");
fr.setSize(600,900);
fr.setFont(new Font("Helvetica", Font.PLAIN, 12));
jmb = new JMenuBar();
fr.setJMenuBar(jmb);
jm = new JMenu("Menu");
jmb.add(jm);
jmI = new JMenuItem("Exit");
jm.add(jmI);
jmI.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ie) {
this.contantPane = new JPanel();
System.exit(-1);
}
});
jm1 = new JMenu("Info");
jmb.add(jm1);
this.fr.setContentPane(contantPane);
contantPane = new JPanel();
fr.setContentPane(contantPane);
this.contantPane.add(new JLabel("Ein Tool der CI!"));
contantPane.add(new JLabel("Ein Tool der CI!"));
this.contantPane.add(new JLabel("1) Tools von Daniel"));
contantPane.add(new JLabel("Tools von Daniel, Eugen, Michael"));
ButtonGroup buttonGroup = new ButtonGroup();
JRadioButton hzeit = new JRadioButton("Hochzeit");
hzeit.setBounds(100, 170, 100, 20);
buttonGroup.add(hzeit);
this.contantPane.add(hzeit);
JRadioButton gtag = new JRadioButton("Geburtstag");
gtag.setBounds(250, 170, 100, 20);
buttonGroup.add(gtag);
this.contantPane.add(gtag);
fr.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
combobox_1 = new JComboBox();
combobox_1.addItem("Daniels Tools");
combobox_1.addItem("Eugen Tools");
combobox_1.addItem("Michaels Tools");
fr.add(combobox_1);
JRadioButton DTools = new JRadioButton("Daniels Tools"); DTools.setBounds(100, 100, 100, 20);
buttonGroup.add(DTools); contantPane.add(DTools);
JRadioButton ETools = new JRadioButton("Eugen Tools"); ETools.setBounds(200, 100, 100, 20);
buttonGroup.add(ETools); contantPane.add(ETools);
JRadioButton MTools = new JRadioButton("Eugen Tools"); MTools.setBounds(300, 100, 100, 20);
buttonGroup.add(MTools); contantPane.add(MTools);
JLabel auswahl = new JLabel("Ihre Auswahl:");
auswahl.setBounds(10, 200, 100, 20);
this.contantPane.add(auswahl);
final JTextField text1 = new JTextField();
contantPane.add(auswahl);
final JTextField text1 = new JTextField("..Bisher keine Auswahl!..");
text1.setBounds(100, 200, 300, 20);
this.contantPane.add(text1);
contantPane.add(text1);
hzeit.addActionListener(new ActionListener() {
DTools.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ie) {
text1.setText("MALE");
}
});
text1.setText("Daniel Tools");
gtag.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ie) {
text1.setText("FEMALE");
}
});
ETools.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ie) {
text1.setText("Eugens Tools");
}
});
this.contantPane.add(new JLabel("2) Tools von Eugen"));
MTools.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ie) {
text1.setText("Michaels Tools");
}
});
contantPane.setVisible(true);
fr.setVisible(true);
fr.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String[] args) {
Main mn = new Main();
}
this.contantPane.add(new JLabel("3) Tools von Michael"));
}
this.contantPane.setVisible(true);
this.fr.setVisible(true);
}
public static void main(String[] args) {
System.out.println("Hello World!");
Main mn = new Main();
}
// Action Listener
private class ActionListener1 implements ActionListener{
@Override
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
}
}

28
src/MainGUI.form

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="MainGUI">
<grid id="27dc6" binding="panel1" default-binding="true" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="618" height="613"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<toolbar id="57dfb">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="-1" height="20"/>
</grid>
</constraints>
<properties/>
<border type="none"/>
<children/>
</toolbar>
<vspacer id="e597a">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
</children>
</grid>
</form>

5
src/MainGUI.java

@ -1,5 +0,0 @@
import javax.swing.*;
public class MainGUI {
private JPanel panel1;
}

28
src/Tage_D.java

@ -98,37 +98,9 @@ public class Tage_D extends JFrame {
this.fr.setVisible(true);
this.fr.setAlwaysOnTop(true);
DerHandler handler = new DerHandler();
menuItem1.addActionListener(handler);
gtag.addActionListener(handler);
hzeit.addActionListener(handler);
}
// Action Listener
private class DerHandler implements ActionListener {
@Override
public void actionPerformed(ActionEvent event) {
String string = "";
/*
if(event.getSource()=hzeit)
string=String.format("Name: %s", event.getActionCommand());
else if(event.getSource()==gtag)
string=String.format("passwortFeld2: %s", event.getActionCommand());
JOptionPane.showMessageDialog(null, string);
}
}
*/
}
}
public static void main(String[] args) {
Tage_D gb = new Tage_D();

Loading…
Cancel
Save