- Booking book = null;
- try {
- if (table.getRowCount()!=0)
- book = bookingM.createBooking(rh, rh.offers.get(row).getFirstDay(), rh.offers.get(row).getLastDay(), telIn.getText());
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- if (book != null) {
- BookRuralHouseConfirmationWindow confirmWindow = new BookRuralHouseConfirmationWindow(
- book);
- confirmWindow.setVisible(true);
+ if (telIn.getText().matches("[976]\\d{2}[.\\- ]?\\d{3}[.\\- ]?\\d{3}")) {
+ Booking book = null;
+ try {
+ if (table.getRowCount()!=0)
+ book = bookingM.createBooking(rh, rh.offers.get(row).getFirstDay(), rh.offers.get(row).getLastDay(), telIn.getText());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ if (book != null) {
+ BookRuralHouseConfirmationWindow confirmWindow = new BookRuralHouseConfirmationWindow(
+ book);
+ confirmWindow.setVisible(true);
+ }
+ } else {
+ labelPhone.setText("Phone format is wrong");