import domain.Offer;
import domain.Owner;
import domain.RuralHouse;
+
import javax.swing.JLabel;
import javax.swing.LayoutStyle.ComponentPlacement;
public class DeleteOfferGUI extends JFrame {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
private JPanel contentPane;
private Owner owner;
- private JComboBox comboBox;
- private JComboBox comboBox_1;
+ private JComboBox<RuralHouse> comboBox;
+ private JComboBox<Offer> comboBox_1;
private JButton btnDelete;
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
- comboBox = new JComboBox(this.owner.getRuralHouses());
+ comboBox = new JComboBox<RuralHouse>(this.owner.getRuralHouses());
- comboBox_1 = new JComboBox(((RuralHouse)comboBox.getSelectedItem()).offers);
+ comboBox_1 = new JComboBox<Offer>();
JRadioButton rdbtnIAmSure = new JRadioButton("I am sure");
btnDelete = new JButton("DELETE");
btnDelete.setEnabled(false);
+ comboBox.addItemListener(new ItemListener() {
+
+ @Override
+ public void itemStateChanged(ItemEvent arg0) {
+ Vector<Offer> vo = ((RuralHouse)comboBox.getSelectedItem()).offers;
+ comboBox_1.removeAllItems();
+ for (Offer of: vo){
+ comboBox_1.addItem(of);;
+ }
+
+ }
+
+ });
+
rdbtnIAmSure.addItemListener(new ItemListener() {
@Override