|
@@ -1,87 +1,103 @@ |
1 |
1 |
|
package gui; |
2 |
2 |
|
|
3 |
|
- |
import javax.swing.*; |
4 |
|
- |
import java.awt.*; |
5 |
|
- |
import java.awt.event.*; |
|
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 |
+ |
|
6 |
10 |
|
|
7 |
11 |
|
import domain.Booking; |
8 |
12 |
|
|
9 |
|
- |
public class BookRuralHouseConfirmationWindow extends JFrame { |
|
13 |
+ |
import java.awt.event.ActionListener; |
|
14 |
+ |
import java.awt.event.ActionEvent; |
10 |
15 |
|
|
11 |
|
- |
private static final long serialVersionUID = 1L; |
12 |
|
- |
private JLabel jLabel1 = new JLabel(); |
13 |
|
- |
private JTextField jTextField1 = new JTextField(); |
14 |
|
- |
private JLabel jLabel2 = new JLabel(); |
15 |
|
- |
private JTextField jTextField2 = new JTextField(); |
16 |
|
- |
private JLabel jLabel3 = new JLabel(); |
17 |
|
- |
private JButton jButton1 = new JButton(); |
18 |
|
- |
private JLabel jLabel4 = new JLabel(); |
19 |
|
- |
private JLabel jLabel5 = new JLabel(); |
20 |
|
- |
private JTextField jTextField3 = new JTextField(); |
21 |
|
- |
private JTextField jTextField4 = new JTextField(); |
22 |
|
- |
|
23 |
|
- |
public BookRuralHouseConfirmationWindow(Booking booking) { |
24 |
|
- |
try { |
25 |
|
- |
jbInit(booking); |
26 |
|
- |
} |
27 |
|
- |
catch(Exception e) { |
28 |
|
- |
e.printStackTrace(); |
29 |
|
- |
} |
30 |
|
- |
} |
31 |
|
- |
|
32 |
|
- |
private void jbInit(Booking booking) throws Exception { |
33 |
|
- |
|
34 |
|
- |
this.getContentPane().setLayout(null); |
35 |
|
- |
this.setSize(new Dimension(416, 316)); |
36 |
|
- |
this.setTitle("Confirm Booking"); |
37 |
|
- |
this.setResizable(false); |
38 |
|
- |
jLabel1.setText("Owner Bank account number:"); |
39 |
|
- |
jLabel1.setBounds(new Rectangle(20, 20, 200, 25)); |
40 |
|
- |
jTextField1.setBounds(new Rectangle(225, 20, 165, 25)); |
41 |
|
- |
jTextField1.setEditable(false); |
42 |
|
- |
jTextField1.setText(booking.getOffer().getRuralHouse().getOwner().getBankAccount()); |
43 |
|
- |
|
44 |
|
- |
jLabel2.setText("Booking number:"); |
45 |
|
- |
jLabel2.setBounds(new Rectangle(20, 60, 130, 25)); |
46 |
|
- |
jTextField2.setBounds(new Rectangle(225, 60, 165, 25)); |
47 |
|
- |
jTextField2.setEditable(false); |
48 |
|
- |
|
49 |
|
- |
jTextField2.setText(Integer.toString(booking.getBookNumber())); |
50 |
|
- |
|
51 |
|
- |
jLabel3.setText("You ought to transfer 20% of the total price of the booking in the next three days."); |
52 |
|
- |
jLabel3.setBounds(new Rectangle(20, 105, 370, 25)); |
53 |
|
- |
jButton1.setText("Accept"); |
54 |
|
- |
jButton1.setBounds(new Rectangle(135, 235, 130, 30)); |
55 |
|
- |
jButton1.addActionListener(new ActionListener() { |
56 |
|
- |
public void actionPerformed(ActionEvent e) { |
57 |
|
- |
jButton1_actionPerformed(e); |
58 |
|
- |
} |
59 |
|
- |
}); |
60 |
|
- |
jLabel4.setText("Total:"); |
61 |
|
- |
jLabel4.setBounds(new Rectangle(70, 140, 85, 25)); |
62 |
|
- |
jLabel5.setText("Deposit amount:"); |
63 |
|
- |
jLabel5.setBounds(new Rectangle(70, 175, 100, 25)); |
64 |
|
- |
jTextField3.setBounds(new Rectangle(180, 140, 115, 25)); |
65 |
|
- |
jTextField3.setEditable(false); |
66 |
|
- |
|
67 |
|
- |
jTextField3.setText(Float.toString(booking.getPrice()) + " �"); |
68 |
|
- |
jTextField4.setBounds(new Rectangle(180, 175, 115, 25)); |
69 |
|
- |
jTextField4.setEditable(false); |
70 |
|
- |
jTextField4.setText(Float.toString(booking.getPrice()*(float)0.2) + " �"); |
71 |
|
- |
this.getContentPane().add(jTextField4, null); |
72 |
|
- |
this.getContentPane().add(jTextField3, null); |
73 |
|
- |
this.getContentPane().add(jLabel5, null); |
74 |
|
- |
this.getContentPane().add(jLabel4, null); |
75 |
|
- |
this.getContentPane().add(jButton1, null); |
76 |
|
- |
this.getContentPane().add(jLabel3, null); |
77 |
|
- |
this.getContentPane().add(jTextField2, null); |
78 |
|
- |
this.getContentPane().add(jLabel2, null); |
79 |
|
- |
this.getContentPane().add(jTextField1, null); |
80 |
|
- |
this.getContentPane().add(jLabel1, null); |
81 |
|
- |
} |
82 |
|
- |
|
83 |
|
- |
private void jButton1_actionPerformed(ActionEvent e) { |
84 |
|
- |
this.setVisible(false); |
85 |
|
- |
} |
|
16 |
+ |
public class BookRuralHouseConfirmationWindow extends JFrame { |
|
17 |
+ |
private static final long serialVersionUID = 1L; |
86 |
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()) + " �"); |
|
84 |
+ |
jTextField4.setBounds(new Rectangle(180, 175, 115, 25)); |
|
85 |
+ |
jTextField4.setEditable(false); |
|
86 |
+ |
jTextField4.setText(Float.toString(book.getPrice()*(float)0.2) + " �"); |
|
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 |
+ |
} |
87 |
103 |
|
} |