59f75423bca21d108273e3fb5e24247f0f121749
[RRRRHHHH_Code] / ruralHouses / src / gui / OwnerMenuGUI.java
1 package gui;
2
3 import java.awt.Frame;
4 import java.awt.event.ActionEvent;
5 import java.awt.event.ActionListener;
6
7 import javax.swing.GroupLayout;
8 import javax.swing.GroupLayout.Alignment;
9 import javax.swing.JButton;
10 import javax.swing.JFrame;
11 import javax.swing.JPanel;
12 import javax.swing.border.EmptyBorder;
13
14 import domain.Owner;
15
16 public class OwnerMenuGUI extends JFrame {
17
18         /**
19          * 
20          */
21         private static final long serialVersionUID = 1L;
22         private JPanel contentPane;
23         private Owner owner;
24
25
26         /**
27          * Create the frame.
28          */
29         public OwnerMenuGUI(Owner o) {
30                 this.setTitle("Owner Menu");
31                 this.getContentPane().setLayout(null);
32                 owner = o;
33                 setBounds(100, 100, 450, 473);
34                 contentPane = new JPanel();
35                 contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
36                 setContentPane(contentPane);
37                 
38                 JButton btnHouses = new JButton("Houses");
39                 btnHouses.addActionListener(new ActionListener() {
40                         public void actionPerformed(ActionEvent e) {
41                                 Frame a = new HousesRelatedOwnerGUI(owner);
42                                 a.setVisible(true);
43                         }
44                 });
45                 
46                 JButton btnOffers = new JButton("Offers");
47                 btnOffers.addActionListener(new ActionListener() {
48                         public void actionPerformed(ActionEvent e) {
49                                 Frame a = new OffersRelatedOwnerGUI(owner);
50                                 a.setVisible(true);
51                         }
52                 });
53                 GroupLayout gl_contentPane = new GroupLayout(contentPane);
54                 gl_contentPane.setHorizontalGroup(
55                         gl_contentPane.createParallelGroup(Alignment.LEADING)
56                                 .addGroup(gl_contentPane.createSequentialGroup()
57                                         .addGap(115)
58                                         .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
59                                                 .addComponent(btnOffers, GroupLayout.PREFERRED_SIZE, 164, GroupLayout.PREFERRED_SIZE)
60                                                 .addComponent(btnHouses, GroupLayout.PREFERRED_SIZE, 164, GroupLayout.PREFERRED_SIZE))
61                                         .addContainerGap(145, Short.MAX_VALUE))
62                 );
63                 gl_contentPane.setVerticalGroup(
64                         gl_contentPane.createParallelGroup(Alignment.LEADING)
65                                 .addGroup(gl_contentPane.createSequentialGroup()
66                                         .addGap(62)
67                                         .addComponent(btnHouses, GroupLayout.PREFERRED_SIZE, 81, GroupLayout.PREFERRED_SIZE)
68                                         .addGap(58)
69                                         .addComponent(btnOffers, GroupLayout.PREFERRED_SIZE, 81, GroupLayout.PREFERRED_SIZE)
70                                         .addContainerGap(142, Short.MAX_VALUE))
71                 );
72                 contentPane.setLayout(gl_contentPane);
73         }
74
75 }