Git Repository Public Repository

RRRRHHHH_Code

URLs

Copy to Clipboard

Diff Revisions e2ae30 ... vs 46d6c3 ... for ruralHouses/src/gui/RequestDeleteHouseGUI.java

Diff revisions: vs.
  @@ -17,14 +17,17 @@
17 17 import businessLogic.AdminManager;
18 18 import domain.Owner;
19 19 import domain.RuralHouse;
20 + import javax.swing.JLabel;
21 + import javax.swing.LayoutStyle.ComponentPlacement;
20 22
21 23 public class RequestDeleteHouseGUI extends JFrame {
22 24
23 25 private JPanel contentPane;
24 26 private Owner owner;
25 - private JComboBox comboBox;
27 + private JComboBox<RuralHouse> comboBox;
26 28 private JButton btnDelete;
27 29 private AdminManager am;
30 + JLabel feedback = new JLabel("");
28 31
29 32 /**
30 33 * Create the frame.
  @@ -37,12 +40,15 @@
37 40 contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
38 41 setContentPane(contentPane);
39 42
40 - comboBox = new JComboBox(this.owner.getRuralHouses());
43 + comboBox = new JComboBox<RuralHouse>(this.owner.getRuralHouses());
44 + comboBox.setBounds(75, 55, 332, 20);
41 45
42 46
43 47 JRadioButton rdbtnIAmSure = new JRadioButton("I am sure");
48 + rdbtnIAmSure.setBounds(90, 154, 71, 23);
44 49
45 50 btnDelete = new JButton("REQUEST");
51 + btnDelete.setBounds(90, 213, 90, 23);
46 52 btnDelete.setEnabled(false);
47 53
48 54 rdbtnIAmSure.addItemListener(new ItemListener() {
  @@ -58,34 +64,12 @@
58 64 }
59 65 }
60 66 });
61 -
62 - GroupLayout gl_contentPane = new GroupLayout(contentPane);
63 - gl_contentPane.setHorizontalGroup(
64 - gl_contentPane.createParallelGroup(Alignment.LEADING)
65 - .addGroup(gl_contentPane.createSequentialGroup()
66 - .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
67 - .addGroup(gl_contentPane.createSequentialGroup()
68 - .addGap(70)
69 - .addComponent(comboBox, GroupLayout.PREFERRED_SIZE, 332, GroupLayout.PREFERRED_SIZE))
70 - .addGroup(gl_contentPane.createSequentialGroup()
71 - .addGap(85)
72 - .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING)
73 - .addComponent(btnDelete)
74 - .addComponent(rdbtnIAmSure))))
75 - .addContainerGap(954, Short.MAX_VALUE))
76 - );
77 - gl_contentPane.setVerticalGroup(
78 - gl_contentPane.createParallelGroup(Alignment.LEADING)
79 - .addGroup(gl_contentPane.createSequentialGroup()
80 - .addGap(50)
81 - .addComponent(comboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
82 - .addGap(68)
83 - .addComponent(rdbtnIAmSure)
84 - .addGap(47)
85 - .addComponent(btnDelete)
86 - .addContainerGap(493, Short.MAX_VALUE))
87 - );
88 - contentPane.setLayout(gl_contentPane);
67 + contentPane.setLayout(null);
68 + contentPane.add(comboBox);
69 + contentPane.add(rdbtnIAmSure);
70 + contentPane.add(btnDelete);
71 + feedback.setBounds(90, 184, 274, 18);
72 + contentPane.add(feedback);
89 73
90 74 btnDelete.addActionListener(new ActionListener() {
91 75 public void actionPerformed(ActionEvent arg0) {
  @@ -100,6 +84,11 @@
100 84 private void actionListenerButton(ActionEvent e){
101 85 RuralHouse toDel = (RuralHouse)comboBox.getSelectedItem();
102 86
103 - am.addDeletionRequest(toDel);
87 + if(am.addDeletionRequest(toDel)){
88 + feedback.setText("Delete request sended");
89 +
90 + }else{
91 + feedback.setText("Request cannot be sended(Already sended)");
92 + }
104 93 }
105 94 }