Add "AddLabeledTextBox"

This commit is contained in:
Matti 2024-06-06 19:52:55 +02:00
parent 238759ad89
commit ba814ad400
2 changed files with 13 additions and 2 deletions

View File

@ -7,8 +7,10 @@ public class Demo {
// w.display();
// }
aufg gudWindow = new aufg("Title", 300, 420);
aufg gudWindow = new aufg("Mein Geilo GUI", 300, 420);
gudWindow.addLabeledTextField("TextBox");
gudWindow.addMenuBar();
gudWindow.display(true);
}
}

View File

@ -24,6 +24,7 @@ public class aufg {
public void display(boolean exitOnClose){
this.window.setTitle(this.title);
this.window.setSize(this.width, this.height);
this.window.setContentPane(this.contentPane);
this.window.setVisible(true);
if (exitOnClose){
@ -61,4 +62,12 @@ public class aufg {
this.window.setJMenuBar(this.menubar);
}
public void addLabeledTextField(String labelText){
JLabel label = new JLabel(labelText);
JTextField textField = new JTextField(10);
this.contentPane.add(label);
this.contentPane.add(textField);
}
}