unification with the actual initial project. Some things are new now, but there has...
[RRRRHHHH_Code] / ruralHouses / src / gui / BookRuralHouseConfirmationWindow.java
1 package gui;
2
3 import javax.swing.JFrame;
4 import java.awt.Dimension;
5 import javax.swing.JLabel;
6 import java.awt.Rectangle;
7 import javax.swing.JTextField;
8 import javax.swing.JButton;
9
10
11 import domain.Booking;
12
13 import java.awt.event.ActionListener;
14 import java.awt.event.ActionEvent;
15
16 public class BookRuralHouseConfirmationWindow extends JFrame {
17  private static final long serialVersionUID = 1L;
18         
19   private JLabel jLabel1 = new JLabel();
20   private JTextField jTextField1 = new JTextField();
21   private JLabel jLabel2 = new JLabel();
22   private JTextField jTextField2 = new JTextField();
23   private JLabel jLabel3 = new JLabel();
24   private JButton jButton1 = new JButton();
25   private JLabel jLabel4 = new JLabel();
26   private JLabel jLabel5 = new JLabel();
27   private JTextField jTextField3 = new JTextField();
28   private JTextField jTextField4 = new JTextField();
29
30   public BookRuralHouseConfirmationWindow(Booking book)
31   {
32     try
33     {
34       jbInit(book);
35     }
36     catch(Exception e)
37     {
38       e.printStackTrace();
39     }
40
41   }
42
43   private void jbInit(Booking book) throws Exception
44   {
45           
46
47     this.getContentPane().setLayout(null);
48     this.setSize(new Dimension(416, 316));
49     this.setTitle("See Booking Details");
50     this.setResizable(false);
51     jLabel1.setText("Owner Bank account number:");
52     jLabel1.setBounds(new Rectangle(20, 20, 200, 25));
53     jTextField1.setBounds(new Rectangle(225, 20, 165, 25));
54     jTextField1.setEditable(false);
55
56     jTextField1.setText(book.getOffer().getRuralHouse().getOwner().getBankAccount());
57     
58     jLabel2.setText("Booking number:");
59     jLabel2.setBounds(new Rectangle(20, 60, 130, 25));
60     jTextField2.setBounds(new Rectangle(225, 60, 165, 25));
61     jTextField2.setEditable(false);
62
63     jTextField2.setText(Integer.toString(book.getBookNumber()));
64     
65     jLabel3.setText("You must deposit 20% of the total ammount of a book in the next three days.");
66     jLabel3.setBounds(new Rectangle(20, 105, 370, 25));
67     jButton1.setText("Close");
68     jButton1.setBounds(new Rectangle(135, 235, 130, 30));
69     jButton1.addActionListener(new ActionListener()
70       {
71         public void actionPerformed(ActionEvent e)
72         {
73           jButton1_actionPerformed(e);
74         }
75       });
76     jLabel4.setText("Total:");
77     jLabel4.setBounds(new Rectangle(70, 140, 85, 25));
78     jLabel5.setText("Deposit ammount:");
79     jLabel5.setBounds(new Rectangle(70, 175, 100, 25));
80     jTextField3.setBounds(new Rectangle(180, 140, 115, 25));
81     jTextField3.setEditable(false);
82
83     jTextField3.setText(Float.toString(book.getPrice()) + " \80");
84     jTextField4.setBounds(new Rectangle(180, 175, 115, 25));
85     jTextField4.setEditable(false);
86     jTextField4.setText(Float.toString(book.getPrice()*(float)0.2) + " \80");
87     this.getContentPane().add(jTextField4, null);
88     this.getContentPane().add(jTextField3, null);
89     this.getContentPane().add(jLabel5, null);
90     this.getContentPane().add(jLabel4, null);
91     this.getContentPane().add(jButton1, null);
92     this.getContentPane().add(jLabel3, null);
93     this.getContentPane().add(jTextField2, null);
94     this.getContentPane().add(jLabel2, null);
95     this.getContentPane().add(jTextField1, null);
96     this.getContentPane().add(jLabel1, null);
97   }
98
99   private void jButton1_actionPerformed(ActionEvent e)
100   {
101     this.setVisible(false);
102   }
103 }