Added GarbageGUI

This commit is contained in:
Christoph J. Scherr 2023-05-22 09:35:16 +02:00
parent 59e2bc107d
commit 804a88d08b
Signed by: PlexSheep
GPG Key ID: 25B4ACF7D88186CC
6 changed files with 134 additions and 54 deletions

View File

@ -4,6 +4,7 @@
<modules>
<module fileurl="file://$PROJECT_DIR$/DHBWTest/DHBWTest.iml" filepath="$PROJECT_DIR$/DHBWTest/DHBWTest.iml" />
<module fileurl="file://$PROJECT_DIR$/Fahrzeug/Fahrzeug.iml" filepath="$PROJECT_DIR$/Fahrzeug/Fahrzeug.iml" />
<module fileurl="file://$PROJECT_DIR$/GarbageGUI/GarbageGUI.iml" filepath="$PROJECT_DIR$/GarbageGUI/GarbageGUI.iml" />
<module fileurl="file://$PROJECT_DIR$/Kapselung/Kapselung.iml" filepath="$PROJECT_DIR$/Kapselung/Kapselung.iml" />
<module fileurl="file://$PROJECT_DIR$/ModifyStringArrayList/ModifyStringArrayList.iml" filepath="$PROJECT_DIR$/ModifyStringArrayList/ModifyStringArrayList.iml" />
<module fileurl="file://$PROJECT_DIR$/PassValid/PassValid.iml" filepath="$PROJECT_DIR$/PassValid/PassValid.iml" />

View File

@ -4,30 +4,13 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="7992561a-5a42-4f2e-a81a-79d8a9c03d77" name="Changes" comment="more simple stuff">
<change afterPath="$PROJECT_DIR$/DHBWTest/.gitignore" afterDir="false" />
<change afterPath="$PROJECT_DIR$/DHBWTest/DHBWTest.iml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/DHBWTest/src/Main.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Fahrzeug/.gitignore" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Fahrzeug/Fahrzeug.iml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Fahrzeug/src/Fahrrad.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Fahrzeug/src/Fahrzeug.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/ModifyStringArrayList/.gitignore" afterDir="false" />
<change afterPath="$PROJECT_DIR$/ModifyStringArrayList/ModifyStringArrayList.iml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/ModifyStringArrayList/src/ModifyStringArrayList.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/ModifyStringArrayList/src/ModifyStringArrayListMain.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Person/.gitignore" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Person/Person.iml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Person/src/Person.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Person/src/PersonMain.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/ThreadTask/.gitignore" afterDir="false" />
<change afterPath="$PROJECT_DIR$/ThreadTask/ThreadTask.iml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/ThreadTask/src/Main.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/density/.gitignore" afterDir="false" />
<change afterPath="$PROJECT_DIR$/density/density.iml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/density/src/Density.java" afterDir="false" />
<list default="true" id="7992561a-5a42-4f2e-a81a-79d8a9c03d77" name="Changes" comment="Tasks for 2023-05-22">
<change afterPath="$PROJECT_DIR$/GarbageGUI/.gitignore" afterDir="false" />
<change afterPath="$PROJECT_DIR$/GarbageGUI/GarbageGUI.iml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/GarbageGUI/src/GarbageGUI.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/modules.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/modules.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/density/src/Density.java" beforeDir="false" afterPath="$PROJECT_DIR$/density/src/Density.java" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -52,29 +35,30 @@
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">{
&quot;keyToString&quot;: {
&quot;ASKED_ADD_EXTERNAL_FILES&quot;: &quot;true&quot;,
&quot;ASKED_MARK_IGNORED_FILES_AS_EXCLUDED&quot;: &quot;true&quot;,
&quot;ASKED_SHARE_PROJECT_CONFIGURATION_FILES&quot;: &quot;true&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;SHARE_PROJECT_CONFIGURATION_FILES&quot;: &quot;true&quot;,
&quot;git-widget-placeholder&quot;: &quot;master&quot;,
&quot;jdk.selected.JAVA_MODULE&quot;: &quot;17&quot;,
&quot;jdk.selected.com.intellij.ui.dsl.builder.impl.RowImpl.sdk&quot;: &quot;17&quot;,
&quot;last_opened_file_path&quot;: &quot;/home/plex/Documents/code/java/dhbw&quot;,
&quot;project.structure.last.edited&quot;: &quot;Modules&quot;,
&quot;project.structure.proportion&quot;: &quot;0.0&quot;,
&quot;project.structure.side.proportion&quot;: &quot;0.0&quot;,
&quot;settings.editor.selected.configurable&quot;: &quot;preferences.lookFeel&quot;
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"ASKED_ADD_EXTERNAL_FILES": "true",
"ASKED_MARK_IGNORED_FILES_AS_EXCLUDED": "true",
"ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
"full.screen.before.presentation.mode": "false",
"git-widget-placeholder": "master",
"jdk.selected.JAVA_MODULE": "17",
"jdk.selected.com.intellij.ui.dsl.builder.impl.RowImpl.sdk": "17",
"last_opened_file_path": "/home/plex/Documents/code/java/dhbw",
"project.structure.last.edited": "Modules",
"project.structure.proportion": "0.0",
"project.structure.side.proportion": "0.0",
"settings.editor.selected.configurable": "preferences.lookFeel"
},
&quot;keyToStringList&quot;: {
&quot;jdk.preference.com.intellij.ui.dsl.builder.impl.RowImpl.sdk&quot;: [
&quot;17=/usr/lib/jvm/java-17&quot;
"keyToStringList": {
"jdk.preference.com.intellij.ui.dsl.builder.impl.RowImpl.sdk": [
"17=/usr/lib/jvm/java-17"
]
}
}</component>
<component name="RunManager" selected="Application.Main">
}]]></component>
<component name="RunManager" selected="Application.GarbageGUI">
<configuration name="Density" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="Density" />
<module name="density" />
@ -82,6 +66,13 @@
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="GarbageGUI" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="GarbageGUI" />
<module name="GarbageGUI" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="Main" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="Main" />
<module name="ThreadTask" />
@ -96,13 +87,6 @@
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="PassValid" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="PassValid" />
<module name="PassValid" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="PersonMain" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="PersonMain" />
<module name="Person" />
@ -112,11 +96,11 @@
</configuration>
<recent_temporary>
<list>
<item itemvalue="Application.GarbageGUI" />
<item itemvalue="Application.Density" />
<item itemvalue="Application.Main" />
<item itemvalue="Application.PersonMain" />
<item itemvalue="Application.ModifyStringArrayListMain" />
<item itemvalue="Application.Density" />
<item itemvalue="Application.PassValid" />
</list>
</recent_temporary>
</component>
@ -178,7 +162,14 @@
<option name="project" value="LOCAL" />
<updated>1682344398810</updated>
</task>
<option name="localTasksCounter" value="8" />
<task id="LOCAL-00008" summary="Tasks for 2023-05-22">
<created>1684699543078</created>
<option name="number" value="00008" />
<option name="presentableId" value="LOCAL-00008" />
<option name="project" value="LOCAL" />
<updated>1684699543078</updated>
</task>
<option name="localTasksCounter" value="9" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -212,7 +203,8 @@
<MESSAGE value="schiffe overengineered" />
<MESSAGE value="del out dir" />
<MESSAGE value="more simple stuff" />
<option name="LAST_COMMIT_MESSAGE" value="more simple stuff" />
<MESSAGE value="Tasks for 2023-05-22" />
<option name="LAST_COMMIT_MESSAGE" value="Tasks for 2023-05-22" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>

29
GarbageGUI/.gitignore vendored Normal file
View File

@ -0,0 +1,29 @@
### IntelliJ IDEA ###
out/
!**/src/main/**/out/
!**/src/test/**/out/
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store

11
GarbageGUI/GarbageGUI.iml Normal file
View File

@ -0,0 +1,11 @@
<?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" />
</component>
</module>

View File

@ -0,0 +1,46 @@
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class GarbageGUI {
public static void main(String[] args) {
JFrame f=new JFrame("Amogus!");//creating instance of JFrame
JLabel l1=new JLabel("Input name:");
JLabel l2=new JLabel("Ergebnis: ");
JButton b=new JButton("Do thing");
JTextField tf = new JTextField("Name");
DefaultListModel<String> grets = new DefaultListModel<>();
grets.addElement("Hello");
grets.addElement("Moin");
grets.addElement("Linux Gruß");
JList gretList = new JList(grets);
l1.setBounds(50,0, 100,30);
l2.setBounds(50,400, 300,30);
tf.setBounds(150, 0, 200, 30);
b.setBounds(0, 0, 30, 30);
gretList.setBounds(50,50,400, 300);
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String data = "";
if (gretList.getSelectedIndex() != -1) {
data = "Ergebnis: " + gretList.getSelectedValue() + ", " + tf.getText();
l2.setText(data);
}
}
});
f.add(gretList);//adding button in JFrame
f.add(l1);
f.add(l2);
f.add(b);
f.add(tf);
f.setSize(500,500);//400 width and 500 height
f.setLayout(null);//using no layout managers
f.setVisible(true);//making the frame visible
}
}

View File

@ -25,7 +25,8 @@ public class Density {
}
System.out.println("input mass");
int mass = scanner.nextInt();
// does not throw an division by 0 exception for float datatypes, instead says that density is 'Infinity'
// does not throw a division by 0 exception for float datatype,
// instead says that density is 'Infinity'
float density = (float) mass / volume;
System.out.printf("density: %f%n", density);
} catch (ArithmeticException e) {