Git Repository Public Repository

RRRRHHHH_Code

URLs

Copy to Clipboard

Diff Revisions 837fab ... vs 520867 ... for ruralHouses/src/gui/HouseFeaturesGUI.java

Diff revisions: vs.
  @@ -9,7 +9,6 @@
9 9 import java.util.Date;
10 10 import java.util.Enumeration;
11 11 import java.util.Vector;
12 -
13 12 import javax.swing.JButton;
14 13 import javax.swing.JFrame;
15 14 import javax.swing.JLabel;
  @@ -53,7 +52,7 @@
53 52 private RuralHouse rh;
54 53 private JTextField telIn;
55 54 private int row;
56 - private JLabel phoneNum;
55 + private JLabel labelPhone;
57 56
58 57 /**
59 58 * Create the frame.
  @@ -185,7 +184,7 @@
185 184 JLabel lblNewLabel = new JLabel(
186 185 "Green: Suit your dates. Red: Do not suit your dates");
187 186 lblNewLabel.setEnabled(false);
188 - lblNewLabel.setBounds(170, 282, 261, 23);
187 + lblNewLabel.setBounds(152, 277, 261, 23);
189 188 contentPane.add(lblNewLabel);
190 189
191 190 JLabel lblNewLabel_1 = new JLabel("Telephone num:");
  @@ -197,9 +196,9 @@
197 196 contentPane.add(telIn);
198 197 telIn.setColumns(10);
199 198
200 - phoneNum = new JLabel("");
201 - phoneNum.setBounds(215, 255, 201, 15);
202 - contentPane.add(phoneNum);
199 + labelPhone = new JLabel("");
200 + labelPhone.setBounds(238, 252, 178, 14);
201 + contentPane.add(labelPhone);
203 202 table.addMouseListener( new MouseAdapter(){
204 203 @Override
205 204 public void mouseClicked(MouseEvent arg0) {
  @@ -250,24 +249,21 @@
250 249 private void jButton_ActionPerformed(ActionEvent arg0) {
251 250 BookingManager bookingM = new BookingManager();
252 251 //RegExp to see if telephone number is correct??TODO
253 - if (!telIn.getText().matches("[976]\\d{2}[.\\- ]?\\d{3}[.\\- ]?\\d{3}")){
254 - phoneNum.setText("Wrong phone format");
255 - }else {
256 - phoneNum.setText("");
257 -
258 - Booking book = null;
259 - try {
260 - if (table.getRowCount()!=0)
261 - book = bookingM.createBooking(rh, rh.offers.get(row).getFirstDay(), rh.offers.get(row).getLastDay(), telIn.getText());
262 - } catch (Exception e) {
263 - // TODO Auto-generated catch block
264 - e.printStackTrace();
265 - }
266 - if (book != null) {
267 - BookRuralHouseConfirmationWindow confirmWindow = new BookRuralHouseConfirmationWindow(
268 - book);
269 - confirmWindow.setVisible(true);
270 - }
252 + if (telIn.getText().matches("[976]\\d{2}[.\\- ]?\\d{3}[.\\- ]?\\d{3}")) {
253 + Booking book = null;
254 + try {
255 + if (table.getRowCount()!=0)
256 + book = bookingM.createBooking(rh, rh.offers.get(row).getFirstDay(), rh.offers.get(row).getLastDay(), telIn.getText());
257 + } catch (Exception e) {
258 + e.printStackTrace();
259 + }
260 + if (book != null) {
261 + BookRuralHouseConfirmationWindow confirmWindow = new BookRuralHouseConfirmationWindow(
262 + book);
263 + confirmWindow.setVisible(true);
264 + }
265 + } else {
266 + labelPhone.setText("Phone format is wrong");
271 267 }
272 268 }
273 269 }