a7d292ff15dcd6da3380f4c96670a3e0ef8820b4
[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.addActionListener(new ActionListener() {
53                         public void actionPerformed(ActionEvent e) {
54                                 
55                                 Frame a = new ModifyHouseGUI(owner);
56                                 a.setVisible(true);
57                                 
58                         }
59                 });
60                 
61                 JButton btnDeleteHouses = new JButton("Delete Houses");
62                 btnDeleteHouses.addActionListener(new ActionListener() {
63                         public void actionPerformed(ActionEvent e) {
64                                 Frame a = new DeleteHouseGUI(owner);
65                                 a.setVisible(true);
66                         }
67                 });
68                 GroupLayout gl_contentPane = new GroupLayout(contentPane);
69                 gl_contentPane.setHorizontalGroup(
70                         gl_contentPane.createParallelGroup(Alignment.LEADING)
71                                 .addGroup(gl_contentPane.createSequentialGroup()
72                                         .addGap(110)
73                                         .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING)
74                                                 .addComponent(btnDeleteHouses, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 1125, Short.MAX_VALUE)
75                                                 .addComponent(btnModifyHouses, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 1125, Short.MAX_VALUE)
76                                                 .addComponent(btnCreateHouses, GroupLayout.DEFAULT_SIZE, 1125, Short.MAX_VALUE))
77                                         .addGap(121))
78                 );
79                 gl_contentPane.setVerticalGroup(
80                         gl_contentPane.createParallelGroup(Alignment.LEADING)
81                                 .addGroup(gl_contentPane.createSequentialGroup()
82                                         .addGap(88)
83                                         .addComponent(btnCreateHouses, GroupLayout.PREFERRED_SIZE, 58, GroupLayout.PREFERRED_SIZE)
84                                         .addGap(40)
85                                         .addComponent(btnModifyHouses, GroupLayout.PREFERRED_SIZE, 57, GroupLayout.PREFERRED_SIZE)
86                                         .addGap(39)
87                                         .addComponent(btnDeleteHouses, GroupLayout.PREFERRED_SIZE, 54, GroupLayout.PREFERRED_SIZE)
88                                         .addContainerGap(394, Short.MAX_VALUE))
89                 );
90                 contentPane.setLayout(gl_contentPane);
91         }
92 }