4 import java.awt.Rectangle;
6 import java.util.Vector;
8 import businessLogic.ApplicationFacadeInterface;
10 import domain.RuralHouse;
13 public class IntroduceOfferGUI extends JFrame {
15 private static final long serialVersionUID = 1L;
16 private JPanel jContentPane = null;
17 private JComboBox jComboBox = null;
18 private JButton jButton = null;
20 public IntroduceOfferGUI() {
25 private void initialize() {
26 this.setSize(449, 293);
27 this.setContentPane(getJContentPane());
28 this.setTitle("Choose owner");
32 private JPanel getJContentPane() {
33 if (jContentPane == null) {
34 jContentPane = new JPanel();
35 jContentPane.setLayout(null);
36 jContentPane.add(getJComboBox(), null);
37 jContentPane.add(getJButton(), null);
42 private JComboBox getJComboBox() {
43 if (jComboBox == null) {
45 ApplicationFacadeInterface facade=StartWindow.getBusinessLogic();
46 Vector<Owner> owners=facade.getOwners();
47 jComboBox = new JComboBox(owners);
48 jComboBox.setBounds(new Rectangle(63, 38, 175, 44));
51 // TODO Auto-generated catch block
58 private JButton getJButton() {
59 if (jButton == null) {
60 jButton = new JButton();
61 jButton.setBounds(new Rectangle(113, 146, 95, 59));
62 jButton.setText("Show houses");
63 jButton.addActionListener(new java.awt.event.ActionListener() {
64 public void actionPerformed(java.awt.event.ActionEvent e) {
65 Owner owner=(Owner)jComboBox.getSelectedItem();
66 System.out.println(owner.getUsername());
67 Vector<RuralHouse> houseList=null;
69 //Obtain the business logic from a StartWindow class (local or remote)
70 ApplicationFacadeInterface facade=StartWindow.getBusinessLogic();
71 houseList=facade.getRuralHouses(owner);
74 catch (Exception e1) {
77 if (houseList.isEmpty()!=true) {
78 JFrame a = new IntroduceOffer2GUI(houseList);
81 else if (houseList.isEmpty()==true) {
82 System.out.print("Owner does not exist or has no registered houses ");
90 } // @jve:decl-index=0:visual-constraint="222,33"