分支合并01 #1

Merged
p9w4vtjq6 merged 1 commits from fengyajing_branch into master 4 months ago

@ -6,513 +6,541 @@ import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* Title : Admin_Flights_Panel.java
* Description : This class build the panel for administer to choose flight.
* Title : Admin_Flights_Panel.java
* Description :
*/
public class Admin_Flights_Panel extends JPanel {
public static String flight_num="";
// 存储选中的航班号
public static String flight_num = "";
/**
*
*/
public Admin_Flights_Panel() {
// 设置背景颜色为紫色系
setBackground(new Color(72, 46, 115));
public Admin_Flights_Panel(){
//Set background color
setBackground(new Color(72,46,115));
//Set initial panel
// 创建主面板并设置布局
JPanel panel = new JPanel();
panel.setBackground(new Color(72,46,115));
panel.setPreferredSize(new Dimension(1200,680));
panel.setBackground(new Color(72, 46, 115));
panel.setPreferredSize(new Dimension(1200, 680));
panel.setLayout(null);
add(panel);
// 创建航班号输入框
JTextField InputArea = new JTextField("", 30);
//Appearance design
InputArea.setBounds(450,60,300,50);
InputArea.setFont(new Font (Font.DIALOG,Font.BOLD, 40));
// 设置输入框外观样式
InputArea.setBounds(450, 60, 300, 50);
InputArea.setFont(new Font(Font.DIALOG, Font.BOLD, 40));
InputArea.setHorizontalAlignment(JTextField.CENTER);
InputArea.setForeground(Color.WHITE);
InputArea.setBackground(new Color(72,46,115));
InputArea.setBackground(new Color(72, 46, 115));
InputArea.setEditable(true);
InputArea.setBorder(BorderFactory.createLineBorder(Color.WHITE, 2));
// 创建标题标签
JLabel Head = new JLabel("SEARCH OR SELECT FLIGHTS");
Head.setBounds(184,0,816,50);
//Appearance design
Head.setFont(new Font(Font.DIALOG,Font.BOLD,29));//设置文字字体
Head.setForeground(Color.white);//设置文字的颜色
Head.setBounds(184, 0, 816, 50);
// 设置标题外观样式
Head.setFont(new Font(Font.DIALOG, Font.BOLD, 29));
Head.setForeground(Color.white);
Head.setOpaque(true);
Head.setBackground(new Color(72,46,115));
Head.setPreferredSize(new Dimension(800,80));
Head.setBackground(new Color(72, 46, 115));
Head.setPreferredSize(new Dimension(800, 80));
Head.setHorizontalAlignment(JLabel.CENTER);
// 将标题和输入框添加到主面板
panel.add(Head);
panel.add(InputArea);
// 创建中部显示面板,用于展示航班列表
JPanel middlePanel = new JPanel();
middlePanel.setBounds(50,120,1100,500);
middlePanel.setBounds(50, 120, 1100, 500);
// 使用网格包布局管理器
GridBagLayout gbl = new GridBagLayout();
GridBagConstraints gbc = new GridBagConstraints();
middlePanel.setLayout(gbl);
gbc.fill=GridBagConstraints.BOTH;
gbc.fill = GridBagConstraints.BOTH;
// 创建表头行
JLabel information11 = new JLabel();
information11.setPreferredSize(new Dimension(110,100));
information11.setPreferredSize(new Dimension(110, 100));
information11.setOpaque(true);
information11.setBackground(new Color(232, 232, 232));
gbc.weightx=0.1; // Specify the assignment area of the component
gbc.weighty=0.2;
gbc.gridwidth=1;
gbc.gridheight=1;
gbc.gridx=0;
gbc.gridy=0;
gbl.setConstraints(information11,gbc);
gbc.weightx = 0.1;
gbc.weighty = 0.2;
gbc.gridwidth = 1;
gbc.gridheight = 1;
gbc.gridx = 0;
gbc.gridy = 0;
gbl.setConstraints(information11, gbc);
middlePanel.add(information11);
JLabel information12 = new JLabel("Flights",SwingConstants.CENTER);
information12.setPreferredSize(new Dimension(220,100));
information12.setFont(new Font(Font.DIALOG,Font.PLAIN,28));//Set text font
information12.setForeground(Color.black);//Sets the color of the text
JLabel information12 = new JLabel("Flights", SwingConstants.CENTER);
information12.setPreferredSize(new Dimension(220, 100));
information12.setFont(new Font(Font.DIALOG, Font.PLAIN, 28));
information12.setForeground(Color.black);
information12.setOpaque(true);
information12.setBackground(new Color(232, 232, 232));
gbc.weightx=0.2; // Specify the assignment area of the component
gbc.weighty=0.2;
gbc.gridwidth=1;
gbc.gridheight=1;
gbc.gridx=1;
gbc.gridy=0;
gbl.setConstraints(information12,gbc);
gbc.weightx = 0.2;
gbc.weighty = 0.2;
gbc.gridwidth = 1;
gbc.gridheight = 1;
gbc.gridx = 1;
gbc.gridy = 0;
gbl.setConstraints(information12, gbc);
middlePanel.add(information12);
JLabel information13 = new JLabel("Destination",SwingConstants.CENTER);
information13.setPreferredSize(new Dimension(220,100));
information13.setFont(new Font(Font.DIALOG,Font.PLAIN,28));//Set text font
information13.setForeground(Color.black);//Sets the color of the text
JLabel information13 = new JLabel("Destination", SwingConstants.CENTER);
information13.setPreferredSize(new Dimension(220, 100));
information13.setFont(new Font(Font.DIALOG, Font.PLAIN, 28));
information13.setForeground(Color.black);
information13.setOpaque(true);
information13.setBackground(new Color(232, 232, 232));
gbc.weightx=0.2; // Specify the assignment area of the component
gbc.weighty=0.2;
gbc.gridwidth=1;
gbc.gridheight=1;
gbc.gridx=2;
gbc.gridy=0;
gbl.setConstraints(information13,gbc);
gbc.weightx = 0.2;
gbc.weighty = 0.2;
gbc.gridwidth = 1;
gbc.gridheight = 1;
gbc.gridx = 2;
gbc.gridy = 0;
gbl.setConstraints(information13, gbc);
middlePanel.add(information13);
JLabel information14 = new JLabel("Departs",SwingConstants.CENTER);
information14.setPreferredSize(new Dimension(220,100));
information14.setFont(new Font(Font.DIALOG,Font.PLAIN,28));//Set text font
information14.setForeground(Color.black);//Sets the color of the text
JLabel information14 = new JLabel("Departs", SwingConstants.CENTER);
information14.setPreferredSize(new Dimension(220, 100));
information14.setFont(new Font(Font.DIALOG, Font.PLAIN, 28));
information14.setForeground(Color.black);
information14.setOpaque(true);
information14.setBackground(new Color(232, 232, 232));
gbc.weightx=0.2; // Specify the assignment area of the component
gbc.weighty=0.2;
gbc.gridwidth=1;
gbc.gridheight=1;
gbc.gridx=3;
gbc.gridy=0;
gbl.setConstraints(information14,gbc);
gbc.weightx = 0.2;
gbc.weighty = 0.2;
gbc.gridwidth = 1;
gbc.gridheight = 1;
gbc.gridx = 3;
gbc.gridy = 0;
gbl.setConstraints(information14, gbc);
middlePanel.add(information14);
JLabel information15 = new JLabel("State",SwingConstants.CENTER);
information15.setPreferredSize(new Dimension(330,100));
information15.setFont(new Font(Font.DIALOG,Font.PLAIN,28));//Set text font
information15.setForeground(Color.black);//Sets the color of the text
JLabel information15 = new JLabel("State", SwingConstants.CENTER);
information15.setPreferredSize(new Dimension(330, 100));
information15.setFont(new Font(Font.DIALOG, Font.PLAIN, 28));
information15.setForeground(Color.black);
information15.setOpaque(true);
information15.setBackground(new Color(232, 232, 232));
gbc.weightx=0.3; // Specify the assignment area of the component
gbc.weighty=0.2;
gbc.gridwidth=1;
gbc.gridheight=1;
gbc.gridx=4;
gbc.gridy=0;
gbl.setConstraints(information15,gbc);
gbc.weightx = 0.3;
gbc.weighty = 0.2;
gbc.gridwidth = 1;
gbc.gridheight = 1;
gbc.gridx = 4;
gbc.gridy = 0;
gbl.setConstraints(information15, gbc);
middlePanel.add(information15);
// 第一个航班信息行
JLabel information21 = new JLabel();
information21.setPreferredSize(new Dimension(110,100));
information21.setPreferredSize(new Dimension(110, 100));
information21.setOpaque(true);
information21.setBackground(new Color(252, 250, 250));
JButton button1 = new JButton();
button1.setSize(110,100);
button1.setSize(110, 100);
button1.setBackground(new Color(96, 62, 151));
button1.setVisible(true);
information21.add(button1);
gbc.weightx=0.1; // Specify the assignment area of the component
gbc.weighty=0.2;
gbc.gridwidth=1;
gbc.gridheight=1;
gbc.gridx=0;
gbc.gridy=1;
gbl.setConstraints(information21,gbc);
gbc.weightx = 0.1;
gbc.weighty = 0.2;
gbc.gridwidth = 1;
gbc.gridheight = 1;
gbc.gridx = 0;
gbc.gridy = 1;
gbl.setConstraints(information21, gbc);
middlePanel.add(information21);
JLabel information22 = new JLabel("BA0342",SwingConstants.CENTER);
information22.setPreferredSize(new Dimension(220,100));
information22.setFont(new Font(Font.DIALOG,Font.PLAIN,28));//Set text font
information22.setForeground(Color.black);//Sets the color of the text
JLabel information22 = new JLabel("BA0342", SwingConstants.CENTER);
information22.setPreferredSize(new Dimension(220, 100));
information22.setFont(new Font(Font.DIALOG, Font.PLAIN, 28));
information22.setForeground(Color.black);
information22.setOpaque(true);
information22.setBackground(new Color(252, 250, 250));
gbc.weightx=0.2; // Specify the assignment area of the component
gbc.weighty=0.2;
gbc.gridwidth=1;
gbc.gridheight=1;
gbc.gridx=1;
gbc.gridy=1;
gbl.setConstraints(information22,gbc);
gbc.weightx = 0.2;
gbc.weighty = 0.2;
gbc.gridwidth = 1;
gbc.gridheight = 1;
gbc.gridx = 1;
gbc.gridy = 1;
gbl.setConstraints(information22, gbc);
middlePanel.add(information22);
JLabel information23 = new JLabel("Milan",SwingConstants.CENTER);
information23.setPreferredSize(new Dimension(220,100));
information23.setFont(new Font(Font.DIALOG,Font.PLAIN,28));
JLabel information23 = new JLabel("Milan", SwingConstants.CENTER);
information23.setPreferredSize(new Dimension(220, 100));
information23.setFont(new Font(Font.DIALOG, Font.PLAIN, 28));
information23.setForeground(Color.black);
information23.setOpaque(true);
information23.setBackground(new Color(252, 250, 250));
gbc.weightx=0.2;
gbc.weighty=0.2;
gbc.gridwidth=1;
gbc.gridheight=1;
gbc.gridx=2;
gbc.gridy=1;
gbl.setConstraints(information23,gbc);
gbc.weightx = 0.2;
gbc.weighty = 0.2;
gbc.gridwidth = 1;
gbc.gridheight = 1;
gbc.gridx = 2;
gbc.gridy = 1;
gbl.setConstraints(information23, gbc);
middlePanel.add(information23);
JLabel information24 = new JLabel("7:00AM",SwingConstants.CENTER);
information24.setPreferredSize(new Dimension(220,100));
information24.setFont(new Font(Font.DIALOG,Font.PLAIN,28));
JLabel information24 = new JLabel("7:00AM", SwingConstants.CENTER);
information24.setPreferredSize(new Dimension(220, 100));
information24.setFont(new Font(Font.DIALOG, Font.PLAIN, 28));
information24.setForeground(Color.black);
information24.setOpaque(true);
information24.setBackground(new Color(252, 250, 250));
gbc.weightx=0.2;
gbc.weighty=0.2;
gbc.gridwidth=1;
gbc.gridheight=1;
gbc.gridx=3;
gbc.gridy=1;
gbl.setConstraints(information24,gbc);
gbc.weightx = 0.2;
gbc.weighty = 0.2;
gbc.gridwidth = 1;
gbc.gridheight = 1;
gbc.gridx = 3;
gbc.gridy = 1;
gbl.setConstraints(information24, gbc);
middlePanel.add(information24);
JLabel information25 = new JLabel("DELAYED",SwingConstants.CENTER);
information25.setPreferredSize(new Dimension(330,100));
information25.setFont(new Font(Font.DIALOG,Font.PLAIN,28));
JLabel information25 = new JLabel("DELAYED", SwingConstants.CENTER);
information25.setPreferredSize(new Dimension(330, 100));
information25.setFont(new Font(Font.DIALOG, Font.PLAIN, 28));
information25.setForeground(Color.black);
information25.setOpaque(true);
information25.setBackground(new Color(252, 250, 250));
gbc.weightx=0.3;
gbc.weighty=0.2;
gbc.gridwidth=1;
gbc.gridheight=1;
gbc.gridx=4;
gbc.gridy=1;
gbl.setConstraints(information25,gbc);
gbc.weightx = 0.3;
gbc.weighty = 0.2;
gbc.gridwidth = 1;
gbc.gridheight = 1;
gbc.gridx = 4;
gbc.gridy = 1;
gbl.setConstraints(information25, gbc);
middlePanel.add(information25);
// 第二个航班信息行
JLabel information31 = new JLabel();
information31.setPreferredSize(new Dimension(110,100));
information31.setPreferredSize(new Dimension(110, 100));
information31.setOpaque(true);
information31.setBackground(new Color(232, 232, 232));
JButton button2 = new JButton();
button2.setSize(110,100);
button2.setSize(110, 100);
button2.setBackground(new Color(96, 62, 151));
button2.setVisible(true);
information31.add(button2);
gbc.weightx=0.1;
gbc.weighty=0.2;
gbc.gridwidth=1;
gbc.gridheight=1;
gbc.gridx=0;
gbc.gridy=2;
gbl.setConstraints(information31,gbc);
gbc.weightx = 0.1;
gbc.weighty = 0.2;
gbc.gridwidth = 1;
gbc.gridheight = 1;
gbc.gridx = 0;
gbc.gridy = 2;
gbl.setConstraints(information31, gbc);
middlePanel.add(information31);
JLabel information32 = new JLabel("BA0570",SwingConstants.CENTER);
information32.setPreferredSize(new Dimension(220,100));
information32.setFont(new Font(Font.DIALOG,Font.PLAIN,28));
JLabel information32 = new JLabel("BA0570", SwingConstants.CENTER);
information32.setPreferredSize(new Dimension(220, 100));
information32.setFont(new Font(Font.DIALOG, Font.PLAIN, 28));
information32.setForeground(Color.black);
information32.setOpaque(true);
information32.setBackground(new Color(232, 232, 232));
gbc.weightx=0.2;
gbc.weighty=0.2;
gbc.gridwidth=1;
gbc.gridheight=1;
gbc.gridx=1;
gbc.gridy=2;
gbl.setConstraints(information32,gbc);
gbc.weightx = 0.2;
gbc.weighty = 0.2;
gbc.gridwidth = 1;
gbc.gridheight = 1;
gbc.gridx = 1;
gbc.gridy = 2;
gbl.setConstraints(information32, gbc);
middlePanel.add(information32);
JLabel information33 = new JLabel("Milan",SwingConstants.CENTER);
information33.setPreferredSize(new Dimension(220,100));
information33.setFont(new Font(Font.DIALOG,Font.PLAIN,28));
JLabel information33 = new JLabel("Milan", SwingConstants.CENTER);
information33.setPreferredSize(new Dimension(220, 100));
information33.setFont(new Font(Font.DIALOG, Font.PLAIN, 28));
information33.setForeground(Color.black);
information33.setOpaque(true);
information33.setBackground(new Color(232, 232, 232));
gbc.weightx=0.2;
gbc.weighty=0.2;
gbc.gridwidth=1;
gbc.gridheight=1;
gbc.gridx=2;
gbc.gridy=2;
gbl.setConstraints(information33,gbc);
gbc.weightx = 0.2;
gbc.weighty = 0.2;
gbc.gridwidth = 1;
gbc.gridheight = 1;
gbc.gridx = 2;
gbc.gridy = 2;
gbl.setConstraints(information33, gbc);
middlePanel.add(information33);
JLabel information34 = new JLabel("1:00PM",SwingConstants.CENTER);
information34.setPreferredSize(new Dimension(220,100));
information34.setFont(new Font(Font.DIALOG,Font.PLAIN,28));
JLabel information34 = new JLabel("1:00PM", SwingConstants.CENTER);
information34.setPreferredSize(new Dimension(220, 100));
information34.setFont(new Font(Font.DIALOG, Font.PLAIN, 28));
information34.setForeground(Color.black);
information34.setOpaque(true);
information34.setBackground(new Color(232, 232, 232));
gbc.weightx=0.2;
gbc.weighty=0.2;
gbc.gridwidth=1;
gbc.gridheight=1;
gbc.gridx=3;
gbc.gridy=2;
gbl.setConstraints(information34,gbc);
gbc.weightx = 0.2;
gbc.weighty = 0.2;
gbc.gridwidth = 1;
gbc.gridheight = 1;
gbc.gridx = 3;
gbc.gridy = 2;
gbl.setConstraints(information34, gbc);
middlePanel.add(information34);
JLabel information35 = new JLabel("ON TIME",SwingConstants.CENTER);
information35.setPreferredSize(new Dimension(330,100));
information35.setFont(new Font(Font.DIALOG,Font.PLAIN,28));
JLabel information35 = new JLabel("ON TIME", SwingConstants.CENTER);
information35.setPreferredSize(new Dimension(330, 100));
information35.setFont(new Font(Font.DIALOG, Font.PLAIN, 28));
information35.setForeground(Color.black);
information35.setOpaque(true);
information35.setBackground(new Color(232, 232, 232));
gbc.weightx=0.3;
gbc.weighty=0.2;
gbc.gridwidth=1;
gbc.gridheight=1;
gbc.gridx=4;
gbc.gridy=2;
gbl.setConstraints(information35,gbc);
gbc.weightx = 0.3;
gbc.weighty = 0.2;
gbc.gridwidth = 1;
gbc.gridheight = 1;
gbc.gridx = 4;
gbc.gridy = 2;
gbl.setConstraints(information35, gbc);
middlePanel.add(information35);
// 第三个航班信息行
JLabel information41 = new JLabel();
information41.setPreferredSize(new Dimension(110,100));
information41.setPreferredSize(new Dimension(110, 100));
information41.setOpaque(true);
information41.setBackground(new Color(252, 250, 250));
JButton button3 = new JButton();
button3.setSize(110,100);
button3.setSize(110, 100);
button3.setBackground(new Color(96, 62, 151));
button3.setVisible(true);
information41.add(button3);
gbc.weightx=0.1;
gbc.weighty=0.2;
gbc.gridwidth=1;
gbc.gridheight=1;
gbc.gridx=0;
gbc.gridy=3;
gbl.setConstraints(information41,gbc);
gbc.weightx = 0.1;
gbc.weighty = 0.2;
gbc.gridwidth = 1;
gbc.gridheight = 1;
gbc.gridx = 0;
gbc.gridy = 3;
gbl.setConstraints(information41, gbc);
middlePanel.add(information41);
JLabel information42 = new JLabel("BA0580",SwingConstants.CENTER);
information42.setPreferredSize(new Dimension(220,100));
information42.setFont(new Font(Font.DIALOG,Font.PLAIN,28));
JLabel information42 = new JLabel("BA0580", SwingConstants.CENTER);
information42.setPreferredSize(new Dimension(220, 100));
information42.setFont(new Font(Font.DIALOG, Font.PLAIN, 28));
information42.setForeground(Color.black);
information42.setOpaque(true);
information42.setBackground(new Color(252, 250, 250));
gbc.weightx=0.2;
gbc.weighty=0.2;
gbc.gridwidth=1;
gbc.gridheight=1;
gbc.gridx=1;
gbc.gridy=3;
gbl.setConstraints(information42,gbc);
gbc.weightx = 0.2;
gbc.weighty = 0.2;
gbc.gridwidth = 1;
gbc.gridheight = 1;
gbc.gridx = 1;
gbc.gridy = 3;
gbl.setConstraints(information42, gbc);
middlePanel.add(information42);
JLabel information43 = new JLabel("Pairs",SwingConstants.CENTER);
information43.setPreferredSize(new Dimension(220,100));
information43.setFont(new Font(Font.DIALOG,Font.PLAIN,28));
JLabel information43 = new JLabel("Pairs", SwingConstants.CENTER);
information43.setPreferredSize(new Dimension(220, 100));
information43.setFont(new Font(Font.DIALOG, Font.PLAIN, 28));
information43.setForeground(Color.black);
information43.setOpaque(true);
information43.setBackground(new Color(252, 250, 250));
gbc.weightx=0.2;
gbc.weighty=0.2;
gbc.gridwidth=1;
gbc.gridheight=1;
gbc.gridx=2;
gbc.gridy=3;
gbl.setConstraints(information43,gbc);
gbc.weightx = 0.2;
gbc.weighty = 0.2;
gbc.gridwidth = 1;
gbc.gridheight = 1;
gbc.gridx = 2;
gbc.gridy = 3;
gbl.setConstraints(information43, gbc);
middlePanel.add(information43);
JLabel information44 = new JLabel("8:00AM",SwingConstants.CENTER);
information44.setPreferredSize(new Dimension(220,100));
information44.setFont(new Font(Font.DIALOG,Font.PLAIN,28));
JLabel information44 = new JLabel("8:00AM", SwingConstants.CENTER);
information44.setPreferredSize(new Dimension(220, 100));
information44.setFont(new Font(Font.DIALOG, Font.PLAIN, 28));
information44.setForeground(Color.black);
information44.setOpaque(true);
information44.setBackground(new Color(252, 250, 250));
gbc.weightx=0.2;
gbc.weighty=0.2;
gbc.gridwidth=1;
gbc.gridheight=1;
gbc.gridx=3;
gbc.gridy=3;
gbl.setConstraints(information44,gbc);
gbc.weightx = 0.2;
gbc.weighty = 0.2;
gbc.gridwidth = 1;
gbc.gridheight = 1;
gbc.gridx = 3;
gbc.gridy = 3;
gbl.setConstraints(information44, gbc);
middlePanel.add(information44);
JLabel information45 = new JLabel("ON TIME",SwingConstants.CENTER);
information45.setPreferredSize(new Dimension(330,100));
information45.setFont(new Font(Font.DIALOG,Font.PLAIN,28));
JLabel information45 = new JLabel("ON TIME", SwingConstants.CENTER);
information45.setPreferredSize(new Dimension(330, 100));
information45.setFont(new Font(Font.DIALOG, Font.PLAIN, 28));
information45.setForeground(Color.black);
information45.setOpaque(true);
information45.setBackground(new Color(252, 250, 250));
gbc.weightx=0.3;
gbc.weighty=0.2;
gbc.gridwidth=1;
gbc.gridheight=1;
gbc.gridx=4;
gbc.gridy=3;
gbl.setConstraints(information45,gbc);
gbc.weightx = 0.3;
gbc.weighty = 0.2;
gbc.gridwidth = 1;
gbc.gridheight = 1;
gbc.gridx = 4;
gbc.gridy = 3;
gbl.setConstraints(information45, gbc);
middlePanel.add(information45);
// 第四个航班信息行
JLabel information51 = new JLabel();
information51.setPreferredSize(new Dimension(110,100));
information51.setPreferredSize(new Dimension(110, 100));
information51.setOpaque(true);
information51.setBackground(new Color(232, 232, 232));
JButton button4 = new JButton();
button4.setSize(110,100);
button4.setSize(110, 100);
button4.setBackground(new Color(96, 62, 151));
button4.setVisible(true);
information51.add(button4);
gbc.weightx=0.1;
gbc.weighty=0.2;
gbc.gridwidth=1;
gbc.gridheight=1;
gbc.gridx=0;
gbc.gridy=4;
gbl.setConstraints(information51,gbc);
gbc.weightx = 0.1;
gbc.weighty = 0.2;
gbc.gridwidth = 1;
gbc.gridheight = 1;
gbc.gridx = 0;
gbc.gridy = 4;
gbl.setConstraints(information51, gbc);
middlePanel.add(information51);
JLabel information52 = new JLabel("BA0341",SwingConstants.CENTER);
information52.setPreferredSize(new Dimension(220,100));
information52.setFont(new Font(Font.DIALOG,Font.PLAIN,28));
JLabel information52 = new JLabel("BA0341", SwingConstants.CENTER);
information52.setPreferredSize(new Dimension(220, 100));
information52.setFont(new Font(Font.DIALOG, Font.PLAIN, 28));
information52.setForeground(Color.black);
information52.setOpaque(true);
information52.setBackground(new Color(232, 232, 232));
gbc.weightx=0.2;
gbc.weighty=0.2;
gbc.gridwidth=1;
gbc.gridheight=1;
gbc.gridx=1;
gbc.gridy=4;
gbl.setConstraints(information52,gbc);
gbc.weightx = 0.2;
gbc.weighty = 0.2;
gbc.gridwidth = 1;
gbc.gridheight = 1;
gbc.gridx = 1;
gbc.gridy = 4;
gbl.setConstraints(information52, gbc);
middlePanel.add(information52);
JLabel information53 = new JLabel("Pairs",SwingConstants.CENTER);
information53.setPreferredSize(new Dimension(220,100));
information53.setFont(new Font(Font.DIALOG,Font.PLAIN,28));
JLabel information53 = new JLabel("Pairs", SwingConstants.CENTER);
information53.setPreferredSize(new Dimension(220, 100));
information53.setFont(new Font(Font.DIALOG, Font.PLAIN, 28));
information53.setForeground(Color.black);
information53.setOpaque(true);
information53.setBackground(new Color(232, 232, 232));
gbc.weightx=0.2;
gbc.weighty=0.2;
gbc.gridwidth=1;
gbc.gridheight=1;
gbc.gridx=2;
gbc.gridy=4;
gbl.setConstraints(information53,gbc);
gbc.weightx = 0.2;
gbc.weighty = 0.2;
gbc.gridwidth = 1;
gbc.gridheight = 1;
gbc.gridx = 2;
gbc.gridy = 4;
gbl.setConstraints(information53, gbc);
middlePanel.add(information53);
JLabel information54 = new JLabel("5:00PM",SwingConstants.CENTER);
information54.setPreferredSize(new Dimension(220,100));
information54.setFont(new Font(Font.DIALOG,Font.PLAIN,28));
JLabel information54 = new JLabel("5:00PM", SwingConstants.CENTER);
information54.setPreferredSize(new Dimension(220, 100));
information54.setFont(new Font(Font.DIALOG, Font.PLAIN, 28));
information54.setForeground(Color.black);
information54.setOpaque(true);
information54.setBackground(new Color(232, 232, 232));
gbc.weightx=0.2;
gbc.weighty=0.2;
gbc.gridwidth=1;
gbc.gridheight=1;
gbc.gridx=3;
gbc.gridy=4;
gbl.setConstraints(information54,gbc);
gbc.weightx = 0.2;
gbc.weighty = 0.2;
gbc.gridwidth = 1;
gbc.gridheight = 1;
gbc.gridx = 3;
gbc.gridy = 4;
gbl.setConstraints(information54, gbc);
middlePanel.add(information54);
JLabel information55 = new JLabel("DELAYED",SwingConstants.CENTER);
information55.setPreferredSize(new Dimension(330,100));
information55.setFont(new Font(Font.DIALOG,Font.PLAIN,28));
JLabel information55 = new JLabel("DELAYED", SwingConstants.CENTER);
information55.setPreferredSize(new Dimension(330, 100));
information55.setFont(new Font(Font.DIALOG, Font.PLAIN, 28));
information55.setForeground(Color.black);
information55.setOpaque(true);
information55.setBackground(new Color(232, 232, 232));
gbc.weightx=0.3;
gbc.weighty=0.2;
gbc.gridwidth=1;
gbc.gridheight=1;
gbc.gridx=4;
gbc.gridy=4;
gbl.setConstraints(information55,gbc);
gbc.weightx = 0.3;
gbc.weighty = 0.2;
gbc.gridwidth = 1;
gbc.gridheight = 1;
gbc.gridx = 4;
gbc.gridy = 4;
gbl.setConstraints(information55, gbc);
middlePanel.add(information55);
// 将中部面板添加到主面板
panel.add(middlePanel);
// 创建确认按钮
JButton button_confirm = new JButton("CONFIRM");
button_confirm.setFont(new Font(Font.DIALOG,Font.PLAIN,28));
button_confirm.setFont(new Font(Font.DIALOG, Font.PLAIN, 28));
button_confirm.setForeground(Color.white);
button_confirm.setBackground(new Color(250,50,50));
button_confirm.setSize(200,50);
button_confirm.setBackground(new Color(250, 50, 50));
button_confirm.setSize(200, 50);
button_confirm.setVisible(true);
JLabel panel_confirm = new JLabel();
panel_confirm.setBounds(800,60,200,50);
panel_confirm.setBounds(800, 60, 200, 50);
panel_confirm.setOpaque(true);
panel_confirm.setBackground(new Color(250,50,50));
panel_confirm.setPreferredSize(new Dimension(800,80));
panel_confirm.setBackground(new Color(250, 50, 50));
panel_confirm.setPreferredSize(new Dimension(800, 80));
panel_confirm.setHorizontalAlignment(JLabel.CENTER);
panel_confirm.add(button_confirm);
panel.add(panel_confirm);
// 确认按钮事件监听器
button_confirm.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// 重置所有按钮背景色
button1.setBackground(new Color(96, 84, 146));
button2.setBackground(new Color(96 ,84, 146));
button3.setBackground(new Color(96 ,84, 146));
button4.setBackground(new Color(96 ,84, 146));
flight_num=InputArea.getText();
button2.setBackground(new Color(96, 84, 146));
button3.setBackground(new Color(96, 84, 146));
button4.setBackground(new Color(96, 84, 146));
// 获取输入框中的航班号
flight_num = InputArea.getText();
}
});
// 第一个航班按钮事件监听器
button1.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// 高亮当前选中按钮,其他按钮恢复默认颜色
button1.setBackground(new Color(104, 210, 128));
button2.setBackground(new Color(96 ,84, 146));
button3.setBackground(new Color(96 ,84, 146));
button4.setBackground(new Color(96 ,84, 146));
flight_num="BA0342";
button2.setBackground(new Color(96, 84, 146));
button3.setBackground(new Color(96, 84, 146));
button4.setBackground(new Color(96, 84, 146));
flight_num = "BA0342";
}
});
// 第二个航班按钮事件监听器
button2.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// 高亮当前选中按钮,其他按钮恢复默认颜色
button2.setBackground(new Color(104, 210, 128));
button1.setBackground(new Color(96 ,84, 146));
button3.setBackground(new Color(96 ,84, 146));
button4.setBackground(new Color(96 ,84, 146));
flight_num="BA0570";
button1.setBackground(new Color(96, 84, 146));
button3.setBackground(new Color(96, 84, 146));
button4.setBackground(new Color(96, 84, 146));
flight_num = "BA0570";
}
});
// 第三个航班按钮事件监听器
button3.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// 高亮当前选中按钮,其他按钮恢复默认颜色
button3.setBackground(new Color(104, 210, 128));
button1.setBackground(new Color(96 ,84, 146));
button2.setBackground(new Color(96 ,84, 146));
button4.setBackground(new Color(96 ,84, 146));
flight_num="BA0580";
button1.setBackground(new Color(96, 84, 146));
button2.setBackground(new Color(96, 84, 146));
button4.setBackground(new Color(96, 84, 146));
flight_num = "BA0580";
}
});
// 第四个航班按钮事件监听器
button4.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// 高亮当前选中按钮,其他按钮恢复默认颜色
button4.setBackground(new Color(104, 210, 128));
button1.setBackground(new Color(96 ,84, 146));
button2.setBackground(new Color(96 ,84, 146));
button3.setBackground(new Color(96 ,84, 146));
flight_num="BA3041";
button1.setBackground(new Color(96, 84, 146));
button2.setBackground(new Color(96, 84, 146));
button3.setBackground(new Color(96, 84, 146));
flight_num = "BA3041";
}
});
}
}

@ -4,51 +4,51 @@ import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
/**
* Title : Check_in_bookingNum_Panel.java
* Description : This class is used to build an interface for logging in with an order number.
* Title : Check_in_bookingNum_Panel.java
* Description : This class is used to build an interface for logging in with an order number.
*/
public class Check_in_bookingNum_Panel extends JPanel {
public class Check_in_bookingNum_Panel extends JPanel {
// bookingNum_panel点continue会把框里的订单号转成身份证号放在方法下的这个静态变量里
public static String IDnum = "";
//bookingNum_panel点continue会把框里的订单号转成身份证号放在方法下的这个静态变量里
public static String IDnum="";
public Check_in_bookingNum_Panel() {
// 设置背景颜色
IDnum = "";
setBackground(new Color(72, 46, 115));
public Check_in_bookingNum_Panel(){
//设置背景颜色
IDnum="";
setBackground(new Color(72,46,115));
//设置初始面板
// 设置初始面板
JPanel panel = new JPanel();
panel.setBackground(new Color(72,46,115));
panel.setPreferredSize(new Dimension(1200,680));
panel.setBackground(new Color(72, 46, 115));
panel.setPreferredSize(new Dimension(1200, 680));
add(panel);
//取消布局设计
// 取消布局设计
panel.setLayout(null);
// 创建订单号输入框
JTextField BookingNumInputArea = new JTextField("", 30);
//外观设计
BookingNumInputArea.setBounds(284,105,632,50);
BookingNumInputArea.setFont(new Font (Font.DIALOG,Font.BOLD, 40));
// 外观设计
BookingNumInputArea.setBounds(284, 105, 632, 50);
BookingNumInputArea.setFont(new Font(Font.DIALOG, Font.BOLD, 40));
BookingNumInputArea.setHorizontalAlignment(JTextField.CENTER);
BookingNumInputArea.setForeground(Color.WHITE);
BookingNumInputArea.setBackground(new Color(72,46,115));
BookingNumInputArea.setBackground(new Color(72, 46, 115));
BookingNumInputArea.setEditable(false);
BookingNumInputArea.setBorder(BorderFactory.createLineBorder(Color.WHITE, 2));
// 创建订单号输入提示标签
JLabel BookingNumHint = new JLabel("ENTER YOUR BOOKING NUMBER AND SELECT CONFIRM");
BookingNumHint.setBounds(184,45,816,50);
//外观设计
BookingNumHint.setFont(new Font(Font.DIALOG,Font.BOLD,29));//设置文字字体
BookingNumHint.setForeground(Color.white);//设置文字的颜色
BookingNumHint.setOpaque(true);//设置透明效果
BookingNumHint.setBackground(new Color(72,46,115));//设置背景颜色
BookingNumHint.setPreferredSize(new Dimension(800,80));//设置长宽
BookingNumHint.setHorizontalAlignment(JLabel.CENTER);//设置对齐方式
//创建0-9和delete按钮
BookingNumHint.setBounds(184, 45, 816, 50);
// 外观设计
BookingNumHint.setFont(new Font(Font.DIALOG, Font.BOLD, 29)); // 设置文字字体
BookingNumHint.setForeground(Color.white); // 设置文字的颜色
BookingNumHint.setOpaque(true); // 设置透明效果
BookingNumHint.setBackground(new Color(72, 46, 115)); // 设置背景颜色
BookingNumHint.setPreferredSize(new Dimension(800, 80)); // 设置长宽
BookingNumHint.setHorizontalAlignment(JLabel.CENTER); // 设置对齐方式
// 创建0-9和delete按钮
JButton button1 = new JButton("1");
JButton button2 = new JButton("2");
JButton button3 = new JButton("3");
@ -61,75 +61,75 @@ public class Check_in_bookingNum_Panel extends JPanel {
JButton button0 = new JButton("0");
JButton delete = new JButton("Delete");
//按钮外观设计
button1.setBounds(485,215,75,75);
button1.setBackground(new Color(96,62,151));//设置背景颜色
button1.setForeground(Color.white);//设置文字颜色
button1.setFont(new Font (Font.DIALOG, Font.PLAIN, 45));//设置字体大小
button1.setBorder(BorderFactory.createLineBorder(Color.WHITE, 2));//设置边框
//以下同理
// 按钮外观设计
button1.setBounds(485, 215, 75, 75);
button1.setBackground(new Color(96, 62, 151)); // 设置背景颜色
button1.setForeground(Color.white); // 设置文字颜色
button1.setFont(new Font(Font.DIALOG, Font.PLAIN, 45)); // 设置字体大小
button1.setBorder(BorderFactory.createLineBorder(Color.WHITE, 2)); // 设置边框
// 以下同理
button2.setBounds(575,215,75,75);
button2.setBackground(new Color(96,62,151));
button2.setBounds(575, 215, 75, 75);
button2.setBackground(new Color(96, 62, 151));
button2.setForeground(Color.white);
button2.setFont(new Font (Font.DIALOG, Font.PLAIN, 45));
button2.setFont(new Font(Font.DIALOG, Font.PLAIN, 45));
button2.setBorder(BorderFactory.createLineBorder(Color.WHITE, 2));
button3.setBounds(665,215,75,75);
button3.setBackground(new Color(96,62,151));
button3.setBounds(665, 215, 75, 75);
button3.setBackground(new Color(96, 62, 151));
button3.setForeground(Color.white);
button3.setFont(new Font (Font.DIALOG, Font.PLAIN, 45));
button3.setFont(new Font(Font.DIALOG, Font.PLAIN, 45));
button3.setBorder(BorderFactory.createLineBorder(Color.WHITE, 2));
button4.setBounds(485,305,75,75);
button4.setBackground(new Color(96,62,151));
button4.setBounds(485, 305, 75, 75);
button4.setBackground(new Color(96, 62, 151));
button4.setForeground(Color.white);
button4.setFont(new Font (Font.DIALOG, Font.PLAIN, 45));
button4.setFont(new Font(Font.DIALOG, Font.PLAIN, 45));
button4.setBorder(BorderFactory.createLineBorder(Color.WHITE, 2));
button6.setBounds(665,305,75,75);
button6.setBackground(new Color(96,62,151));
button6.setBounds(665, 305, 75, 75);
button6.setBackground(new Color(96, 62, 151));
button6.setForeground(Color.white);
button6.setFont(new Font (Font.DIALOG, Font.PLAIN, 45));
button6.setFont(new Font(Font.DIALOG, Font.PLAIN, 45));
button6.setBorder(BorderFactory.createLineBorder(Color.WHITE, 2));
button5.setBounds(575,305,75,75);
button5.setBackground(new Color(96,62,151));
button5.setBounds(575, 305, 75, 75);
button5.setBackground(new Color(96, 62, 151));
button5.setForeground(Color.white);
button5.setFont(new Font (Font.DIALOG, Font.PLAIN, 45));
button5.setFont(new Font(Font.DIALOG, Font.PLAIN, 45));
button5.setBorder(BorderFactory.createLineBorder(Color.WHITE, 2));
button7.setBounds(487,395,75,75);
button7.setBackground(new Color(96,62,151));
button7.setBounds(487, 395, 75, 75);
button7.setBackground(new Color(96, 62, 151));
button7.setForeground(Color.white);
button7.setFont(new Font (Font.DIALOG, Font.PLAIN, 45));
button7.setFont(new Font(Font.DIALOG, Font.PLAIN, 45));
button7.setBorder(BorderFactory.createLineBorder(Color.WHITE, 2));
button8.setBounds(575,395,75,75);
button8.setBackground(new Color(96,62,151));
button8.setBounds(575, 395, 75, 75);
button8.setBackground(new Color(96, 62, 151));
button8.setForeground(Color.white);
button8.setFont(new Font (Font.DIALOG, Font.PLAIN, 45));
button8.setFont(new Font(Font.DIALOG, Font.PLAIN, 45));
button8.setBorder(BorderFactory.createLineBorder(Color.WHITE, 2));
button9.setBounds(665,395,75,75);
button9.setBackground(new Color(96,62,151));
button9.setBounds(665, 395, 75, 75);
button9.setBackground(new Color(96, 62, 151));
button9.setForeground(Color.white);
button9.setFont(new Font (Font.DIALOG, Font.PLAIN, 45));
button9.setFont(new Font(Font.DIALOG, Font.PLAIN, 45));
button9.setBorder(BorderFactory.createLineBorder(Color.WHITE, 2));
button0.setBounds(575,485,75,75);
button0.setBackground(new Color(96,62,151));
button0.setBounds(575, 485, 75, 75);
button0.setBackground(new Color(96, 62, 151));
button0.setForeground(Color.white);
button0.setFont(new Font (Font.DIALOG, Font.PLAIN, 45));
button0.setFont(new Font(Font.DIALOG, Font.PLAIN, 45));
button0.setBorder(BorderFactory.createLineBorder(Color.WHITE, 2));
delete.setBounds(790,215,126,75);
delete.setBackground(new Color(96,62,151));
delete.setBounds(790, 215, 126, 75);
delete.setBackground(new Color(96, 62, 151));
delete.setForeground(Color.white);
delete.setFont(new Font (Font.DIALOG, Font.PLAIN, 30));
delete.setFont(new Font(Font.DIALOG, Font.PLAIN, 30));
delete.setBorder(BorderFactory.createLineBorder(Color.WHITE, 2));
//将按钮添加到panel上
// 将按钮添加到panel上
panel.add(button1);
panel.add(button3);
panel.add(button2);
@ -144,7 +144,7 @@ public class Check_in_bookingNum_Panel extends JPanel {
panel.add(BookingNumInputArea);
panel.add(BookingNumHint);
//为按钮添加监听事件
// 为按钮添加监听事件
button0.addActionListener(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
@ -155,8 +155,8 @@ public class Check_in_bookingNum_Panel extends JPanel {
button0.addActionListener(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
IDnum=IDnum+"0";//实时更新IDnum
BookingNumInputArea.setText(IDnum);//更新输入框里的内容,以下同理
IDnum = IDnum + "0"; // 实时更新IDnum
BookingNumInputArea.setText(IDnum); // 更新输入框里的内容,以下同理
}
});
@ -164,7 +164,7 @@ public class Check_in_bookingNum_Panel extends JPanel {
button1.addActionListener(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
IDnum=IDnum+"1";
IDnum = IDnum + "1";
BookingNumInputArea.setText(IDnum);
}
});
@ -172,7 +172,7 @@ public class Check_in_bookingNum_Panel extends JPanel {
button2.addActionListener(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
IDnum=IDnum+"2";
IDnum = IDnum + "2";
BookingNumInputArea.setText(IDnum);
}
});
@ -180,7 +180,7 @@ public class Check_in_bookingNum_Panel extends JPanel {
button3.addActionListener(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
IDnum=IDnum+"3";
IDnum = IDnum + "3";
BookingNumInputArea.setText(IDnum);
}
});
@ -188,7 +188,7 @@ public class Check_in_bookingNum_Panel extends JPanel {
button4.addActionListener(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
IDnum=IDnum+"4";
IDnum = IDnum + "4";
BookingNumInputArea.setText(IDnum);
}
});
@ -196,7 +196,7 @@ public class Check_in_bookingNum_Panel extends JPanel {
button5.addActionListener(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
IDnum=IDnum+"5";
IDnum = IDnum + "5";
BookingNumInputArea.setText(IDnum);
}
});
@ -204,7 +204,7 @@ public class Check_in_bookingNum_Panel extends JPanel {
button6.addActionListener(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
IDnum=IDnum+"6";
IDnum = IDnum + "6";
BookingNumInputArea.setText(IDnum);
}
});
@ -212,7 +212,7 @@ public class Check_in_bookingNum_Panel extends JPanel {
button7.addActionListener(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
IDnum=IDnum+"7";
IDnum = IDnum + "7";
BookingNumInputArea.setText(IDnum);
}
});
@ -220,7 +220,7 @@ public class Check_in_bookingNum_Panel extends JPanel {
button8.addActionListener(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
IDnum=IDnum+"8";
IDnum = IDnum + "8";
BookingNumInputArea.setText(IDnum);
}
});
@ -228,7 +228,7 @@ public class Check_in_bookingNum_Panel extends JPanel {
button9.addActionListener(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
IDnum=IDnum+"9";
IDnum = IDnum + "9";
BookingNumInputArea.setText(IDnum);
}
});
@ -236,29 +236,13 @@ public class Check_in_bookingNum_Panel extends JPanel {
delete.addActionListener(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
if(IDnum.length() > 0){
//若文本框内字符串长度大于一,则执行删除命令
IDnum=IDnum.substring(0,IDnum.length()-1);
if (IDnum.length() > 0) {
// 若文本框内字符串长度大于一,则执行删除命令
IDnum = IDnum.substring(0, IDnum.length() - 1);
BookingNumInputArea.setText(IDnum);
}
else;//若没有内容,则不执行删除
} else
; // 若没有内容,则不执行删除
}
});
}
}

Loading…
Cancel
Save