656d76f5c435f3811b94e1f1910c76c6f2d6494c
[RRRRHHHH_Code] / ruralHouses / src / gui / HousesRelatedOwnerGUI.java
1 package gui;
2
3 import java.awt.BorderLayout;
4 import java.awt.EventQueue;
5 import java.awt.Frame;
6
7 import javax.swing.JFrame;
8 import javax.swing.JPanel;
9 import javax.swing.border.EmptyBorder;
10 import javax.swing.JButton;
11 import javax.swing.GroupLayout;
12 import javax.swing.GroupLayout.Alignment;
13
14 import domain.Owner;
15 import domain.RuralHouse;
16
17 import java.awt.event.ActionListener;
18 import java.awt.event.ActionEvent;
19 import java.util.Vector;
20 import javax.swing.JLabel;
21 import java.awt.Color;
22 import java.awt.Font;
23
24 public class HousesRelatedOwnerGUI extends JFrame {
25
26         /**
27          * 
28          */
29         private static final long serialVersionUID = 1L;
30         private JPanel contentPane;
31         private Owner owner;
32         /**
33          * Create the frame.
34          */
35         public HousesRelatedOwnerGUI(Owner o) {
36                 this.getContentPane().setLayout(null);
37                 owner = o;
38                 setBounds(100, 100, 450, 562);
39                 contentPane = new JPanel();
40                 contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
41                 setContentPane(contentPane);
42                 
43                 JButton btnCreateHouses = new JButton("Create Houses");
44                 btnCreateHouses.addActionListener(new ActionListener() {
45                         public void actionPerformed(ActionEvent arg0) {
46                                 Frame a = new NewHouseGUI(owner);
47                                 a.setVisible(true);
48                         }
49                 });
50                 
51                 JButton btnModifyHouses = new JButton("Modify Houses");
52                 btnModifyHouses.setEnabled(false);
53                 btnModifyHouses.addActionListener(new ActionListener() {
54                         public void actionPerformed(ActionEvent e) {
55                                 
56                                 /* TODO to be implemented in a future.
57                                 Frame a = new ModifyHouseGUI(owner);
58                                 a.setVisible(true);
59                                 */
60                         }
61                 });
62                 
63                 JButton btnDeleteHouses = new JButton("Delete Houses");
64                 btnDeleteHouses.setEnabled(false);
65                 btnDeleteHouses.addActionListener(new ActionListener() {
66                         public void actionPerformed(ActionEvent e) {
67                                 Frame a = new DeleteHouseGUI(owner);
68                                 a.setVisible(true);
69                         }
70                 });
71                 GroupLayout gl_contentPane = new GroupLayout(contentPane);
72                 gl_contentPane.setHorizontalGroup(
73                         gl_contentPane.createParallelGroup(Alignment.LEADING)
74                                 .addGroup(gl_contentPane.createSequentialGroup()
75                                         .addGap(110)
76                                         .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING)
77                                                 .addComponent(btnDeleteHouses, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 1125, Short.MAX_VALUE)
78                                                 .addComponent(btnModifyHouses, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 1125, Short.MAX_VALUE)
79                                                 .addComponent(btnCreateHouses, GroupLayout.DEFAULT_SIZE, 1125, Short.MAX_VALUE))
80                                         .addGap(121))
81                 );
82                 gl_contentPane.setVerticalGroup(
83                         gl_contentPane.createParallelGroup(Alignment.LEADING)
84                                 .addGroup(gl_contentPane.createSequentialGroup()
85                                         .addGap(88)
86                                         .addComponent(btnCreateHouses, GroupLayout.PREFERRED_SIZE, 58, GroupLayout.PREFERRED_SIZE)
87                                         .addGap(40)
88                                         .addComponent(btnModifyHouses, GroupLayout.PREFERRED_SIZE, 57, GroupLayout.PREFERRED_SIZE)
89                                         .addGap(39)
90                                         .addComponent(btnDeleteHouses, GroupLayout.PREFERRED_SIZE, 54, GroupLayout.PREFERRED_SIZE)
91                                         .addContainerGap(394, Short.MAX_VALUE))
92                 );
93                 contentPane.setLayout(gl_contentPane);
94         }
95 }