3 import java.awt.BorderLayout;
4 import java.awt.EventQueue;
5 import java.awt.event.ActionEvent;
6 import java.awt.event.ActionListener;
8 import javax.swing.JFrame;
9 import javax.swing.JPanel;
10 import javax.swing.border.EmptyBorder;
11 import javax.swing.GroupLayout;
12 import javax.swing.GroupLayout.Alignment;
13 import javax.swing.JComboBox;
14 import javax.swing.JRadioButton;
15 import javax.swing.JButton;
17 import businessLogic.FacadeImplementation;
18 import businessLogic.HouseManager;
19 import businessLogic.HouseManagerInterface;
21 import domain.RuralHouse;
23 public class DeleteHouseGUI extends JFrame {
25 private JPanel contentPane;
27 private JComboBox comboBox;
34 public DeleteHouseGUI(Owner o) {
36 setBounds(100, 100, 450, 300);
37 contentPane = new JPanel();
38 contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
39 setContentPane(contentPane);
43 comboBox = new JComboBox();
45 JRadioButton rdbtnIAmSure = new JRadioButton("I am sure");
47 JButton btnDelete = new JButton("DELETE");
48 GroupLayout gl_contentPane = new GroupLayout(contentPane);
49 gl_contentPane.setHorizontalGroup(
50 gl_contentPane.createParallelGroup(Alignment.LEADING)
51 .addGroup(gl_contentPane.createSequentialGroup()
52 .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
53 .addGroup(gl_contentPane.createSequentialGroup()
55 .addComponent(comboBox, GroupLayout.PREFERRED_SIZE, 332, GroupLayout.PREFERRED_SIZE))
56 .addGroup(gl_contentPane.createSequentialGroup()
58 .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING)
59 .addComponent(btnDelete)
60 .addComponent(rdbtnIAmSure))))
61 .addContainerGap(954, Short.MAX_VALUE))
63 gl_contentPane.setVerticalGroup(
64 gl_contentPane.createParallelGroup(Alignment.LEADING)
65 .addGroup(gl_contentPane.createSequentialGroup()
67 .addComponent(comboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
69 .addComponent(rdbtnIAmSure)
71 .addComponent(btnDelete)
72 .addContainerGap(493, Short.MAX_VALUE))
74 contentPane.setLayout(gl_contentPane);
76 btnDelete.addActionListener(new ActionListener() {
77 public void actionPerformed(ActionEvent arg0) {
78 actionListenerButton(arg0);
86 private void actionListenerButton(ActionEvent e){
87 RuralHouse toDel = (RuralHouse)comboBox.getSelectedItem();
88 HouseManagerInterface hm = new HouseManager();
89 hm.removeHouse(toDel.getHouseNumber());