Rudimentäre UI eingefügt.
parent
5eaf8853bf
commit
55ae117999
|
@ -0,0 +1,53 @@
|
|||
package gui;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import facade.ImmoMApp;
|
||||
|
||||
public class MainMenu extends JFrame {
|
||||
private ImmoMApp app;
|
||||
|
||||
public static void main(String[] args) {
|
||||
new MainMenu();
|
||||
}
|
||||
|
||||
MainMenu() {
|
||||
app = new ImmoMApp();
|
||||
|
||||
this.setTitle("ImmoMApp");
|
||||
this.setSize(300, 250);
|
||||
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
|
||||
JPanel buttons = new JPanel();
|
||||
buttons.setLayout(new BoxLayout(buttons, BoxLayout.Y_AXIS));
|
||||
|
||||
JButton jb1 = new JButton("Mietgesuch anlegen");
|
||||
jb1.addActionListener((ActionEvent e) -> {
|
||||
new MietgesuchAnlegenUI(app);
|
||||
});
|
||||
|
||||
JButton jb2 = new JButton("Mietgesuche anzeigen");
|
||||
jb2.addActionListener((ActionEvent e) -> {
|
||||
new MietgesucheAnzeigenUI(app);
|
||||
});
|
||||
|
||||
JButton jb3 = new JButton("Beenden");
|
||||
|
||||
buttons.add(new JLabel(" "));
|
||||
buttons.add(jb1);
|
||||
buttons.add(jb2);
|
||||
|
||||
this.add(new JLabel("Willkommen bei der ImmoMApp"), "North");
|
||||
this.add(buttons, "Center");
|
||||
this.add(jb3, "South");
|
||||
|
||||
this.setVisible(true);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
package gui;
|
||||
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
import facade.ImmoMApp;
|
||||
|
||||
public class MietgesuchAnlegenUI extends JFrame {
|
||||
private ImmoMApp app;
|
||||
|
||||
private JTextField zimmer;
|
||||
private JTextField qm;
|
||||
private JTextField miete;
|
||||
private JTextField ort;
|
||||
private JTextArea text;
|
||||
private JTextField mail;
|
||||
|
||||
public MietgesuchAnlegenUI(ImmoMApp app) {
|
||||
this.app = app;
|
||||
|
||||
this.setTitle("ImmoMApp: Mietgesuch anlegen");
|
||||
this.setSize(400, 350);
|
||||
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||
|
||||
JPanel inputs = new JPanel();
|
||||
inputs.setLayout(new BoxLayout(inputs, BoxLayout.Y_AXIS));
|
||||
|
||||
JPanel container = new JPanel();
|
||||
container.add(new JLabel("Zimmer (+ KB): "));
|
||||
container.add(zimmer = new JTextField(5));
|
||||
inputs.add(container);
|
||||
|
||||
container = new JPanel();
|
||||
container.add(new JLabel("Größe (qm): "));
|
||||
container.add(qm = new JTextField(5));
|
||||
inputs.add(container);
|
||||
|
||||
container = new JPanel();
|
||||
container.add(new JLabel("Miete (EUR): "));
|
||||
container.add(miete = new JTextField(5));
|
||||
inputs.add(container);
|
||||
|
||||
container = new JPanel();
|
||||
container.add(new JLabel("Ort: "));
|
||||
container.add(ort = new JTextField(24));
|
||||
inputs.add(container);
|
||||
|
||||
container = new JPanel();
|
||||
container.add(new JLabel("Beschreibung: "));
|
||||
container.add(text = new JTextArea(5, 24));
|
||||
inputs.add(container);
|
||||
|
||||
container = new JPanel();
|
||||
container.add(new JLabel("Mail-Adresse: "));
|
||||
container.add(mail = new JTextField(24));
|
||||
inputs.add(container);
|
||||
|
||||
this.add(inputs, "Center");
|
||||
|
||||
JPanel buttons = new JPanel();
|
||||
|
||||
JButton cancel = new JButton("Verwerfen");
|
||||
cancel.addActionListener(e -> this.dispose());
|
||||
|
||||
JButton ok = new JButton("Speichern");
|
||||
ok.addActionListener(e -> {
|
||||
app.mietgesuchAnlegen(Integer.parseInt(zimmer.getText()), Integer.parseInt(qm.getText()), Integer.parseInt(miete.getText()), ort.getText(), text.getText(), mail.getText());
|
||||
JOptionPane.showMessageDialog(this, "Mietgesuch angelegt.");
|
||||
});
|
||||
|
||||
buttons.add(cancel);
|
||||
buttons.add(ok);
|
||||
|
||||
this.add(buttons, "South");
|
||||
|
||||
this.setVisible(true);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package gui;
|
||||
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
import facade.ImmoMApp;
|
||||
|
||||
public class MietgesucheAnzeigenUI extends JFrame {
|
||||
private ImmoMApp app;
|
||||
|
||||
public MietgesucheAnzeigenUI(ImmoMApp app) {
|
||||
this.app = app;
|
||||
|
||||
this.setTitle("ImmoMApp: Übersicht Mietgesuche");
|
||||
this.setSize(400, 350);
|
||||
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||
|
||||
var mgs = app.mietgesucheAbfragen();
|
||||
|
||||
JLabel jl = new JLabel(mgs.length + " Mietgesuch" + (mgs.length != 1? "e":"") + " verfügbar.");
|
||||
this.add(jl, "North");
|
||||
|
||||
JPanel mietgesuche = new JPanel();
|
||||
mietgesuche.setLayout(new BoxLayout(mietgesuche, BoxLayout.Y_AXIS));
|
||||
|
||||
for (String s : mgs) {
|
||||
jl = new JLabel(s);
|
||||
mietgesuche.add(jl);
|
||||
}
|
||||
|
||||
this.add(mietgesuche, "Center");
|
||||
|
||||
JPanel buttons = new JPanel();
|
||||
|
||||
JButton ok = new JButton("Schließen");
|
||||
ok.addActionListener(e -> this.dispose());
|
||||
|
||||
buttons.add(ok);
|
||||
|
||||
this.add(buttons, "South");
|
||||
|
||||
this.setVisible(true);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue