-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcustomer.java
48 lines (42 loc) · 1.57 KB
/
customer.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class customer extends JFrame {
JButton book = new JButton("Book Airline");
JButton showBooking = new JButton("Show Bookings");
Container pane = getContentPane();
public customer(String title) {
super(title);
pane.setBackground(Color.CYAN);
pane.setLayout(new GridLayout(2, 1));
pane.add(book, BorderLayout.CENTER);
pane.add(showBooking, BorderLayout.CENTER);
book.setForeground((Color.BLUE));
showBooking.setForeground((Color.BLUE));
book.setBackground(new Color(114,212,232));
showBooking.setBackground(new Color(114,212,232));
Listener l = new Listener();
book.addActionListener(l);
showBooking.addActionListener(l);
setMinimumSize(new Dimension(500, 600));
setSize(500, 600);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Ensure that the GUI components are created and modified on the EDT
SwingUtilities.invokeLater(() -> {
setVisible(true);
});
}
class Listener implements ActionListener {
public void actionPerformed(ActionEvent evt) {
if (evt.getSource() == book) {
new bookingPage("Book Flights");
setVisible(false);
} else if (evt.getSource() == showBooking) {
new showPassDetails();
}
}
}
public static void main(String[] args) {
new customer("Customer Page");
}
}