Add Correct Content

This commit is contained in:
Matti 2024-06-07 14:25:11 +02:00
parent a64040170a
commit 1d523ed097
2 changed files with 67 additions and 2 deletions

View File

@ -7,8 +7,8 @@ public class Demo {
// w.display(); // w.display();
// } // }
aufg gudWindow = new aufg("Mein Geilo GUI", 700, 420); aufg gudWindow = new aufg("Mein Geniales GUI", 700, 420);
gudWindow.loadDesign(); gudWindow.loadDesign2();
gudWindow.display(true); gudWindow.display(true);
} }

View File

@ -31,6 +31,43 @@ public class aufg {
} }
} }
public void loadDesign2(){
addMenuBar();
addLabel("Von");
addLabeledTextField("Bahnhof/Haltestelle", false);
addImage("Medien/Bilder/info_I.png");
addLabel("Nach");
addLabeledTextField("Bahnhof/Haltestelle", false);
addButton("über");
addLabel("Hinfahrt");
addLabeledTextField("Datum", false);
addLabel("Rückfahrt");
addLabeledTextField("Uhrzeit", false);
// addDropdown(values = {"Abfahrt", "Ankunft"})
addLabeledTextField("Uhrzeit", false);
// addDropdown(values = {"Abfahrt", "Ankunft"})
addLabel("Angaben zur Preisberechnung");
addLabel("Reisende");
// addDropdown(values = {"1 Erwachsener", "1 Student"})
// addDropdown(values = {"Keine Ermäßigung", "20% Rabatt"})
// addDropDown(values = {"2. Klasse", "1. Klasse"})
addButton("Personen Hinzufügen");
addImage("Medien/Bilder/info_I.png");
addButton("Auslandspreise");
addImage("Medien/Bilder/info_I.png");
addLabel("Angaben zur Verbindung");
addLabel("Verkehrsmittel: ");
// addDropDown(values = {"Standartsuche", "Spezialsuche"})
addButton("Erweitert");
addImage("Medien/Bilder/info_I.png");
// addCheckBox(label = "schnelle Verbindung bevorzugen")
addImage("Medien/Bilder/info_I.png");
// addCheckBox(label = "Fahrradmitnahme")
addButton("Verbindung Suchen");
addButton("Neue Anfrage");
addButton("Mein Anfrageprofil");
}
public void loadDesign(){ public void loadDesign(){
addMenuBar(); addMenuBar();
addLabeledTextField("TextBox", true); addLabeledTextField("TextBox", true);
@ -39,6 +76,12 @@ public class aufg {
addImage("Medien/Bilder/HackerUnicorn_Schäbig.png"); addImage("Medien/Bilder/HackerUnicorn_Schäbig.png");
addLabeledRadioButtons("First Set of radiobuttons", new String[] {"Option1", "Choice2", "Variant3"}, true); addLabeledRadioButtons("First Set of radiobuttons", new String[] {"Option1", "Choice2", "Variant3"}, true);
addLabeledRadioButtons("Second Group of Options", new String[] {"Maybe this?", "Or that"}, true); addLabeledRadioButtons("Second Group of Options", new String[] {"Maybe this?", "Or that"}, true);
// popUpInputText(new String[] {"Choice1", "Option2"});
popUpDropDown("Medien/Bilder/info_I.png",
"Title of my Window",
"choose your favourite",
new String[] {"Choice1", "Option2"},
"Option2");
} }
public void addMenuBar(){ public void addMenuBar(){
@ -162,6 +205,13 @@ public class aufg {
return b; return b;
} }
public void addButton(String text){
this.contentPane.add(makeButton(text));
}
public JButton makeButton(String text){
return new JButton(text);
}
public void addLabeledRadioButtons(String label, String[] options, boolean makeVertical){ public void addLabeledRadioButtons(String label, String[] options, boolean makeVertical){
this.contentPane.add(makeLabeledRadioButtons(label, options, makeVertical)); this.contentPane.add(makeLabeledRadioButtons(label, options, makeVertical));
} }
@ -178,4 +228,19 @@ public class aufg {
return b; return b;
} }
public String popUpInputText(String[] values){
return (String) JOptionPane.showInputDialog(this.contentPane, values);
}
public String popUpDropDown(String iconLink, String title, String message, String[] values, String initialSelection){
return (String) JOptionPane.showInputDialog(
this.contentPane,
message,
title,
JOptionPane.INFORMATION_MESSAGE,
new ImageIcon(iconLink),
values,
initialSelection);
}
} }