Browse Source

Der zweite commit, in welche ich eine Ungültigkeitsabfrage in meiner Fitnesstest Klasse eingebaut habe

welche prüft, ob in den Textfields eine Zahl, mit oder ohne Nachkommastellen, eingegeben wurde.
master
MSeibert97 2 years ago
parent
commit
e0eaed26a3
  1. 74
      .idea/workspace.xml
  2. 39
      src/FitnessTest_M.java

74
.idea/workspace.xml

@ -2,8 +2,8 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="db773f9a-00fd-4a2d-a6a9-bbfafdd60b01" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/src/FitnessTest_M.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Main.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Main.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/FitnessTest_M.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/FitnessTest_M.java" afterDir="false" />
</list>
<ignored path="$PROJECT_DIR$/out/" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
@ -17,11 +17,11 @@
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<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="342">
<caret line="149" lean-forward="true" selection-start-line="149" selection-end-line="149" />
<state relative-caret-position="2533">
<caret line="149" selection-start-line="149" selection-end-line="149" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#2492#2625#0" expanded="true" />
@ -31,15 +31,19 @@
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/FitnessTest_M.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="464">
<caret line="59" column="1" lean-forward="true" selection-start-line="59" selection-start-column="1" selection-end-line="59" selection-end-column="1" />
<state relative-caret-position="411">
<caret line="96" selection-start-line="96" selection-end-line="96" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#1680#1681#0" expanded="true" />
<element signature="e#1732#1733#0" expanded="true" />
<element signature="e#1631#2028#0" expanded="true" />
<element signature="e#2027#2028#0" expanded="true" />
<element signature="e#2388#2785#0" expanded="true" />
<element signature="e#2784#2785#0" expanded="true" />
<element signature="e#2903#2904#0" expanded="true" />
<element signature="e#2956#2957#0" expanded="true" />
</folding>
</state>
</provider>
@ -74,6 +78,11 @@
</replaceStrings>
</component>
<component name="Git.Settings">
<option name="PREVIOUS_COMMIT_AUTHORS">
<list>
<option value="MSeibert97 &lt;michael.seibert@informatik.hs-fulda.de&gt;" />
</list>
</option>
<option name="UPDATE_TYPE" value="MERGE" />
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
@ -88,8 +97,8 @@
<option value="$PROJECT_DIR$/src/Quiz_Spiel.java" />
<option value="$PROJECT_DIR$/src/Tage_DTest.java" />
<option value="$PROJECT_DIR$/src/Tage_D.java" />
<option value="$PROJECT_DIR$/src/FitnessTest_M.java" />
<option value="$PROJECT_DIR$/src/Main.java" />
<option value="$PROJECT_DIR$/src/FitnessTest_M.java" />
</list>
</option>
</component>
@ -393,7 +402,14 @@
<option name="project" value="LOCAL" />
<updated>1563228818747</updated>
</task>
<option name="localTasksCounter" value="23" />
<task id="LOCAL-00023" summary="Der erste commit für meine FitnessTest Klasse. Hier wurde nur ein Grundgerüst für dessen GUI erstellt. Noch sind keine&#10;richtige Funktionen enthalten.">
<created>1563257833088</created>
<option name="number" value="00023" />
<option name="presentableId" value="LOCAL-00023" />
<option name="project" value="LOCAL" />
<updated>1563257833088</updated>
</task>
<option name="localTasksCounter" value="24" />
<servers />
</component>
<component name="TimeTrackingManager">
@ -401,18 +417,19 @@
</component>
<component name="ToolWindowManager">
<frame x="-7" y="-7" width="1295" height="695" extended-state="6" />
<editor active="true" />
<layout>
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.254251" />
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.254251" />
<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.3279743" />
<window_info anchor="bottom" id="Messages" order="0" weight="0.3268206" />
<window_info anchor="bottom" id="Message" order="1" />
<window_info anchor="bottom" id="Find" order="2" weight="0.3290461" />
<window_info anchor="bottom" id="Run" order="3" weight="0.33440515" />
<window_info active="true" anchor="bottom" id="Run" order="3" visible="true" weight="0.124333926" />
<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" />
@ -487,7 +504,8 @@
<MESSAGE value="Tage_D Zufallsgenerator erstellt." />
<MESSAGE value="Tage_D Generator angepasst mit Zeitpunkt Änderung größer dieses Jahres" />
<MESSAGE value="Main und Tage_D erweitert um neue Menübutton und Funktionen optimiert auf Darstellung. Nun werden Zeilen auch direkt neben einander gezeigt." />
<option name="LAST_COMMIT_MESSAGE" value="Main und Tage_D erweitert um neue Menübutton und Funktionen optimiert auf Darstellung. Nun werden Zeilen auch direkt neben einander gezeigt." />
<MESSAGE value="Der erste commit für meine FitnessTest Klasse. Hier wurde nur ein Grundgerüst für dessen GUI erstellt. Noch sind keine&#10;richtige Funktionen enthalten." />
<option name="LAST_COMMIT_MESSAGE" value="Der erste commit für meine FitnessTest Klasse. Hier wurde nur ein Grundgerüst für dessen GUI erstellt. Noch sind keine&#10;richtige Funktionen enthalten." />
</component>
<component name="com.intellij.coverage.CoverageDataManagerImpl">
<SUITE FILE_PATH="coverage/Alpha_GOGS$Main.ic" NAME="Main Coverage Results" MODIFIED="1563229577210" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="idea" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" />
@ -561,26 +579,30 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/FitnessTest_M.java">
<entry file="file://$PROJECT_DIR$/src/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="464">
<caret line="59" column="1" lean-forward="true" selection-start-line="59" selection-start-column="1" selection-end-line="59" selection-end-column="1" />
<state relative-caret-position="2533">
<caret line="149" selection-start-line="149" selection-end-line="149" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#1680#1681#0" expanded="true" />
<element signature="e#1732#1733#0" expanded="true" />
<element signature="e#2492#2625#0" expanded="true" />
<element signature="e#2624#2625#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Main.java">
<entry file="file://$PROJECT_DIR$/src/FitnessTest_M.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="342">
<caret line="149" lean-forward="true" selection-start-line="149" selection-end-line="149" />
<state relative-caret-position="411">
<caret line="96" selection-start-line="96" selection-end-line="96" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#2492#2625#0" expanded="true" />
<element signature="e#2624#2625#0" expanded="true" />
<element signature="e#1631#2028#0" expanded="true" />
<element signature="e#2027#2028#0" expanded="true" />
<element signature="e#2388#2785#0" expanded="true" />
<element signature="e#2784#2785#0" expanded="true" />
<element signature="e#2903#2904#0" expanded="true" />
<element signature="e#2956#2957#0" expanded="true" />
</folding>
</state>
</provider>

39
src/FitnessTest_M.java

@ -1,6 +1,10 @@
import javax.swing.*;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
public class FitnessTest_M extends JFrame {
JFrame frame = null;
@ -14,6 +18,8 @@ public class FitnessTest_M extends JFrame {
JTextField height_tf = null;
JLabel weight_label = null;
JTextField weight_tf = null;
JLabel height_ungueltig = null;
JLabel weight_ungueltig = null;
public FitnessTest_M() {
frame = new JFrame("Fitness Test");
@ -41,14 +47,44 @@ public class FitnessTest_M extends JFrame {
frame.setJMenuBar(menuBar);
height_label = new JLabel("Geben sie hier ihre Körpergröße ein (in Meter)");
height_ungueltig = new JLabel();
height_ungueltig.setForeground(Color.red);
panel_1.add(height_ungueltig);
height_label = new JLabel("Geben sie hier ihre Koerpergroesse ein (in Meter)");
panel_1.add(height_label);
height_tf = new JTextField(40);
height_tf.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
try {
float height = Float.parseFloat(height_tf.getText());
height_ungueltig.setText("");
} catch (NumberFormatException e1) {
height_ungueltig.setText("Ungueltige Nummer");
}
}
});
panel_1.add(height_tf);
weight_ungueltig = new JLabel();
weight_ungueltig.setForeground(Color.red);
panel_1.add(weight_ungueltig);
weight_label = new JLabel("Geben sie hier ihr Gewicht ein (in Kilogramm)");
panel_1.add(weight_label);
weight_tf = new JTextField(40);
weight_tf.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent w) {
try {
float weight = Float.parseFloat(weight_tf.getText());
weight_ungueltig.setText("");
} catch (NumberFormatException w1) {
weight_ungueltig.setText("Ungueltige Nummer");
}
}
});
panel_1.add(weight_tf);
frame.setVisible(true);
@ -58,3 +94,4 @@ public class FitnessTest_M extends JFrame {
FitnessTest_M M = new FitnessTest_M();
}
}
Loading…
Cancel
Save