3 import java.awt.BorderLayout;
4 import java.awt.EventQueue;
6 import javax.swing.JFrame;
7 import javax.swing.JPanel;
8 import javax.swing.border.EmptyBorder;
9 import javax.swing.GroupLayout;
10 import javax.swing.GroupLayout.Alignment;
13 import javax.swing.JLabel;
14 import javax.swing.JTextField;
15 import javax.swing.LayoutStyle.ComponentPlacement;
16 import javax.swing.SwingConstants;
17 import javax.swing.JButton;
19 public class NewHouseGUI extends JFrame {
24 private static final long serialVersionUID = 1L;
25 private JPanel contentPane;
27 private JTextField Code_f;
28 private JLabel lblTown;
29 private JTextField Town_f;
30 private JLabel lblDescription;
31 private JTextField description_f;
32 private JLabel lblKitchen;
33 private JTextField kitchens_f;
34 private JLabel lblRooms;
35 private JTextField rooms_f;
36 private JLabel lblLivings;
37 private JTextField lRooms_f;
38 private JLabel lblParkings;
39 private JTextField parkings_f;
40 private JLabel lblBaths;
41 private JTextField baths_f;
42 private JButton btnRegister;
48 public NewHouseGUI(Owner o) {
49 this.getContentPane().setLayout(null);
51 setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
52 setBounds(100, 100, 450, 583);
53 contentPane = new JPanel();
54 contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
55 setContentPane(contentPane);
57 JLabel lblCode = new JLabel("House Code:");
58 lblCode.setHorizontalAlignment(SwingConstants.RIGHT);
60 Code_f = new JTextField();
61 Code_f.setColumns(10);
63 lblTown = new JLabel("Town:");
64 lblTown.setHorizontalAlignment(SwingConstants.RIGHT);
66 Town_f = new JTextField();
67 Town_f.setColumns(10);
69 lblDescription = new JLabel("Description:");
70 lblDescription.setHorizontalAlignment(SwingConstants.RIGHT);
72 description_f = new JTextField();
73 description_f.setColumns(10);
75 lblKitchen = new JLabel("Kitchens:");
76 lblKitchen.setHorizontalAlignment(SwingConstants.RIGHT);
78 kitchens_f = new JTextField();
79 kitchens_f.setColumns(10);
81 lblRooms = new JLabel("Rooms:");
82 lblRooms.setHorizontalAlignment(SwingConstants.RIGHT);
84 rooms_f = new JTextField();
85 rooms_f.setColumns(10);
87 lblLivings = new JLabel("Living rooms:");
88 lblLivings.setHorizontalAlignment(SwingConstants.RIGHT);
90 lRooms_f = new JTextField();
91 lRooms_f.setColumns(10);
93 lblParkings = new JLabel("Parkings:");
94 lblParkings.setHorizontalAlignment(SwingConstants.RIGHT);
96 parkings_f = new JTextField();
97 parkings_f.setColumns(10);
99 lblBaths = new JLabel("Baths:");
100 lblBaths.setHorizontalAlignment(SwingConstants.RIGHT);
102 baths_f = new JTextField();
103 baths_f.setColumns(10);
105 btnRegister = new JButton("Register House");
106 GroupLayout gl_contentPane = new GroupLayout(contentPane);
107 gl_contentPane.setHorizontalGroup(
108 gl_contentPane.createParallelGroup(Alignment.LEADING)
109 .addGroup(gl_contentPane.createSequentialGroup()
110 .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
111 .addGroup(gl_contentPane.createSequentialGroup()
113 .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING)
114 .addGroup(gl_contentPane.createSequentialGroup()
115 .addComponent(lblParkings, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE)
117 .addComponent(parkings_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
118 .addGroup(gl_contentPane.createSequentialGroup()
119 .addComponent(lblRooms, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE)
121 .addComponent(rooms_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
122 .addGroup(gl_contentPane.createSequentialGroup()
123 .addComponent(lblCode)
125 .addComponent(Code_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
126 .addGroup(gl_contentPane.createSequentialGroup()
127 .addComponent(lblBaths, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE)
129 .addComponent(baths_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
130 .addGroup(gl_contentPane.createSequentialGroup()
131 .addComponent(lblTown, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE)
133 .addComponent(Town_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
134 .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
135 .addGroup(gl_contentPane.createSequentialGroup()
137 .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
138 .addComponent(lblDescription, GroupLayout.PREFERRED_SIZE, 90, GroupLayout.PREFERRED_SIZE)
139 .addGroup(gl_contentPane.createSequentialGroup()
141 .addComponent(description_f, GroupLayout.DEFAULT_SIZE, 201, Short.MAX_VALUE))))
142 .addGroup(gl_contentPane.createSequentialGroup()
144 .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING)
145 .addGroup(gl_contentPane.createSequentialGroup()
146 .addComponent(lblLivings)
148 .addComponent(lRooms_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
149 .addGroup(gl_contentPane.createSequentialGroup()
150 .addComponent(lblKitchen, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE)
152 .addComponent(kitchens_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))))))
153 .addGroup(gl_contentPane.createSequentialGroup()
155 .addComponent(btnRegister)))
158 gl_contentPane.setVerticalGroup(
159 gl_contentPane.createParallelGroup(Alignment.LEADING)
160 .addGroup(gl_contentPane.createSequentialGroup()
162 .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
163 .addGroup(gl_contentPane.createSequentialGroup()
165 .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
166 .addComponent(lblCode)
167 .addComponent(Code_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
168 .addPreferredGap(ComponentPlacement.UNRELATED)
169 .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
170 .addComponent(Town_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
171 .addComponent(lblTown)))
172 .addGroup(gl_contentPane.createSequentialGroup()
174 .addComponent(lblDescription)
175 .addPreferredGap(ComponentPlacement.UNRELATED)
176 .addComponent(description_f, GroupLayout.PREFERRED_SIZE, 129, GroupLayout.PREFERRED_SIZE)))
178 .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
179 .addGroup(gl_contentPane.createSequentialGroup()
181 .addComponent(lblRooms))
182 .addComponent(rooms_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
183 .addGroup(gl_contentPane.createSequentialGroup()
185 .addComponent(lblKitchen))
186 .addComponent(kitchens_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
188 .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING)
189 .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
190 .addGroup(gl_contentPane.createSequentialGroup()
192 .addComponent(lblBaths))
193 .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
194 .addComponent(baths_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
195 .addComponent(lblLivings)))
196 .addComponent(lRooms_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
198 .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
199 .addGroup(gl_contentPane.createSequentialGroup()
201 .addComponent(lblParkings))
202 .addComponent(parkings_f, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
204 .addComponent(btnRegister)
207 contentPane.setLayout(gl_contentPane);