RRRRHHHH_Code
Diff Revisions
5761bc ...
vs
d5b843 ...
for ruralHouses/src/gui/HouseFeaturesGUI.java
|
@@ -53,6 +53,7 @@ |
53 |
53 |
|
private RuralHouse rh; |
54 |
54 |
|
private JTextField telIn; |
55 |
55 |
|
private int row; |
|
56 |
+ |
private JLabel phoneNum; |
56 |
57 |
|
|
57 |
58 |
|
/** |
58 |
59 |
|
* Create the frame. |
|
@@ -184,7 +185,7 @@ |
184 |
185 |
|
JLabel lblNewLabel = new JLabel( |
185 |
186 |
|
"Green: Suit your dates. Red: Do not suit your dates"); |
186 |
187 |
|
lblNewLabel.setEnabled(false); |
187 |
|
- |
lblNewLabel.setBounds(152, 277, 261, 23); |
|
188 |
+ |
lblNewLabel.setBounds(170, 282, 261, 23); |
188 |
189 |
|
contentPane.add(lblNewLabel); |
189 |
190 |
|
|
190 |
191 |
|
JLabel lblNewLabel_1 = new JLabel("Telephone num:"); |
|
@@ -195,6 +196,10 @@ |
195 |
196 |
|
telIn.setBounds(99, 505, 129, 20); |
196 |
197 |
|
contentPane.add(telIn); |
197 |
198 |
|
telIn.setColumns(10); |
|
199 |
+ |
|
|
200 |
+ |
phoneNum = new JLabel(""); |
|
201 |
+ |
phoneNum.setBounds(215, 255, 201, 15); |
|
202 |
+ |
contentPane.add(phoneNum); |
198 |
203 |
|
table.addMouseListener( new MouseAdapter(){ |
199 |
204 |
|
@Override |
200 |
205 |
|
public void mouseClicked(MouseEvent arg0) { |
|
@@ -240,6 +245,11 @@ |
240 |
245 |
|
private void jButton_ActionPerformed(ActionEvent arg0) { |
241 |
246 |
|
BookingManager bookingM = new BookingManager(); |
242 |
247 |
|
//RegExp to see if telephone number is correct??TODO |
|
248 |
+ |
if (!telIn.getText().matches("[976]\\d{2}[.\\- ]?\\d{3}[.\\- ]?\\d{3}")){ |
|
249 |
+ |
phoneNum.setText("Wrong phone format"); |
|
250 |
+ |
}else { |
|
251 |
+ |
phoneNum.setText(""); |
|
252 |
+ |
|
243 |
253 |
|
Booking book = null; |
244 |
254 |
|
try { |
245 |
255 |
|
if (table.getRowCount()!=0) |
|
@@ -253,5 +263,6 @@ |
253 |
263 |
|
book); |
254 |
264 |
|
confirmWindow.setVisible(true); |
255 |
265 |
|
} |
|
266 |
+ |
} |
256 |
267 |
|
} |
257 |
268 |
|
} |