RRRRHHHH_Code
Diff Revisions
95c4ff ...
vs
64482a ...
for ruralHouses/src/gui/DeleteOfferGUI.java
|
@@ -24,15 +24,20 @@ |
24 |
24 |
|
import domain.Offer; |
25 |
25 |
|
import domain.Owner; |
26 |
26 |
|
import domain.RuralHouse; |
|
27 |
+ |
|
27 |
28 |
|
import javax.swing.JLabel; |
28 |
29 |
|
import javax.swing.LayoutStyle.ComponentPlacement; |
29 |
30 |
|
|
30 |
31 |
|
public class DeleteOfferGUI extends JFrame { |
31 |
32 |
|
|
|
33 |
+ |
/** |
|
34 |
+ |
* |
|
35 |
+ |
*/ |
|
36 |
+ |
private static final long serialVersionUID = 1L; |
32 |
37 |
|
private JPanel contentPane; |
33 |
38 |
|
private Owner owner; |
34 |
|
- |
private JComboBox comboBox; |
35 |
|
- |
private JComboBox comboBox_1; |
|
39 |
+ |
private JComboBox<RuralHouse> comboBox; |
|
40 |
+ |
private JComboBox<Offer> comboBox_1; |
36 |
41 |
|
private JButton btnDelete; |
37 |
42 |
|
|
38 |
43 |
|
|
|
@@ -46,17 +51,31 @@ |
46 |
51 |
|
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); |
47 |
52 |
|
setContentPane(contentPane); |
48 |
53 |
|
|
49 |
|
- |
comboBox = new JComboBox(this.owner.getRuralHouses()); |
|
54 |
+ |
comboBox = new JComboBox<RuralHouse>(this.owner.getRuralHouses()); |
50 |
55 |
|
|
51 |
56 |
|
|
52 |
57 |
|
|
53 |
|
- |
comboBox_1 = new JComboBox(((RuralHouse)comboBox.getSelectedItem()).offers); |
|
58 |
+ |
comboBox_1 = new JComboBox<Offer>(); |
54 |
59 |
|
|
55 |
60 |
|
JRadioButton rdbtnIAmSure = new JRadioButton("I am sure"); |
56 |
61 |
|
|
57 |
62 |
|
btnDelete = new JButton("DELETE"); |
58 |
63 |
|
btnDelete.setEnabled(false); |
59 |
64 |
|
|
|
65 |
+ |
comboBox.addItemListener(new ItemListener() { |
|
66 |
+ |
|
|
67 |
+ |
@Override |
|
68 |
+ |
public void itemStateChanged(ItemEvent arg0) { |
|
69 |
+ |
Vector<Offer> vo = ((RuralHouse)comboBox.getSelectedItem()).offers; |
|
70 |
+ |
comboBox_1.removeAllItems(); |
|
71 |
+ |
for (Offer of: vo){ |
|
72 |
+ |
comboBox_1.addItem(of);; |
|
73 |
+ |
} |
|
74 |
+ |
|
|
75 |
+ |
} |
|
76 |
+ |
|
|
77 |
+ |
}); |
|
78 |
+ |
|
60 |
79 |
|
rdbtnIAmSure.addItemListener(new ItemListener() { |
61 |
80 |
|
|
62 |
81 |
|
@Override |