implemented lacking GUIs and corrected errors
[RRRRHHHH_Code] / ruralHouses / src / gui / DeleteHouseGUI.java
diff --git a/ruralHouses/src/gui/DeleteHouseGUI.java b/ruralHouses/src/gui/DeleteHouseGUI.java
new file mode 100644 (file)
index 0000000..0395a15
--- /dev/null
@@ -0,0 +1,91 @@
+package gui;
+
+import java.awt.BorderLayout;
+import java.awt.EventQueue;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.border.EmptyBorder;
+import javax.swing.GroupLayout;
+import javax.swing.GroupLayout.Alignment;
+import javax.swing.JComboBox;
+import javax.swing.JRadioButton;
+import javax.swing.JButton;
+
+import businessLogic.FacadeImplementation;
+import businessLogic.HouseManager;
+
+import domain.Owner;
+import domain.RuralHouse;
+
+public class DeleteHouseGUI extends JFrame {
+
+       private JPanel contentPane;
+       private Owner owner;
+       private JComboBox comboBox;
+
+
+
+       /**
+        * Create the frame.
+        */
+       public DeleteHouseGUI(Owner o) {
+               o = owner;
+               setBounds(100, 100, 450, 300);
+               contentPane = new JPanel();
+               contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
+               setContentPane(contentPane);
+               
+               
+               
+               comboBox = new JComboBox();
+               
+               JRadioButton rdbtnIAmSure = new JRadioButton("I am sure");
+               
+               JButton btnDelete = new JButton("DELETE");
+               GroupLayout gl_contentPane = new GroupLayout(contentPane);
+               gl_contentPane.setHorizontalGroup(
+                       gl_contentPane.createParallelGroup(Alignment.LEADING)
+                               .addGroup(gl_contentPane.createSequentialGroup()
+                                       .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
+                                               .addGroup(gl_contentPane.createSequentialGroup()
+                                                       .addGap(70)
+                                                       .addComponent(comboBox, GroupLayout.PREFERRED_SIZE, 332, GroupLayout.PREFERRED_SIZE))
+                                               .addGroup(gl_contentPane.createSequentialGroup()
+                                                       .addGap(85)
+                                                       .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING)
+                                                               .addComponent(btnDelete)
+                                                               .addComponent(rdbtnIAmSure))))
+                                       .addContainerGap(954, Short.MAX_VALUE))
+               );
+               gl_contentPane.setVerticalGroup(
+                       gl_contentPane.createParallelGroup(Alignment.LEADING)
+                               .addGroup(gl_contentPane.createSequentialGroup()
+                                       .addGap(50)
+                                       .addComponent(comboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+                                       .addGap(68)
+                                       .addComponent(rdbtnIAmSure)
+                                       .addGap(47)
+                                       .addComponent(btnDelete)
+                                       .addContainerGap(493, Short.MAX_VALUE))
+               );
+               contentPane.setLayout(gl_contentPane);
+               
+               btnDelete.addActionListener(new ActionListener() {
+                       public void actionPerformed(ActionEvent arg0) {
+                               actionListenerButton(arg0);
+                               
+                       }
+
+                       
+               });
+       }
+       
+       private void actionListenerButton(ActionEvent e){
+               RuralHouse toDel = (RuralHouse)comboBox.getSelectedItem();
+               HouseManager hm = new HouseManager();
+               hm.removeHouse(toDel.getHouseNumber());
+       }
+}