-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSeatPricingPanel.java
48 lines (36 loc) · 1.27 KB
/
SeatPricingPanel.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.*;
import java.awt.*;
public class SeatPricingPanel extends JPanel {
JTextField priceField, hstField, costField;
public StadiumApp stadiumApp;
public SeatPricingPanel(String title, StadiumApp _stadiumApp)
{
super();
stadiumApp = _stadiumApp;
setLayout(new GridLayout(3,1));
setBorder(BorderFactory.createTitledBorder("SELECTED SEAT PRICING"));
JLabel priceLabel = new JLabel("Seat(s) Price: ");
add(priceLabel);
priceField = new JTextField();
priceField.setHorizontalAlignment(JTextField.RIGHT);
add(priceField);
JLabel hstLabel = new JLabel("HST: ");
add(hstLabel);
hstField = new JTextField();
hstField.setHorizontalAlignment(JTextField.RIGHT);
add(hstField);
JLabel costLabel = new JLabel("Total Cost: ");
add(costLabel);
costField = new JTextField();
costField.setHorizontalAlignment(JTextField.RIGHT);
add(costField);
}
public void setPriceFields (float price, float hst, float total)
{
priceField.setText(String.format("$%1.2f", price));
hstField.setText(String.format("$%1.2f", hst));
costField.setText(String.format("$%1.2f", total));
}
}