diff --git a/src/airline-develop/src/frame/AdminPanel/Admin_Flights_Panel.java b/src/airline-develop/src/frame/AdminPanel/Admin_Flights_Panel.java index 1ce35d8..0c10708 100644 --- a/src/airline-develop/src/frame/AdminPanel/Admin_Flights_Panel.java +++ b/src/airline-develop/src/frame/AdminPanel/Admin_Flights_Panel.java @@ -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"; } - - }); - } - } diff --git a/src/airline-develop/src/frame/AdminPanel/Admin_Information.java b/src/airline-develop/src/frame/AdminPanel/Admin_Information.java index c26d894..9f7db6e 100644 --- a/src/airline-develop/src/frame/AdminPanel/Admin_Information.java +++ b/src/airline-develop/src/frame/AdminPanel/Admin_Information.java @@ -7,1220 +7,1466 @@ import java.awt.event.ActionListener; import java.util.ArrayList; import model.*; + /** * Title : Admin_Information.java * Description : This class build the panel for administer to check the information of chosen flight. */ public class Admin_Information extends JPanel { + int passenger_num = 0; //航班乘客总数 + int pageNum = 1; //当前显示的页码 - int passenger_num=0; - int pageNum = 1 ; - public Admin_Information(String Flight_num){ + //构造函数 根据航班号初始化管理员信息面板 + public Admin_Information(String Flight_num) { //设置背景颜色 - setBackground(new Color(72,46,115)); - //设置初始面板 + 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); + //实例化航班和乘客订单对象 flight f = new flight(); passenger_order po = new passenger_order(); - passenger_num=f.administer_findEachFlight_Num(Flight_num); + + //获取指定航班的乘客数量 + passenger_num = f.administer_findEachFlight_Num(Flight_num); + //获取指定航班的详细信息 ArrayList information = new ArrayList<>(); information = f.administer_findEachFlight_Information(Flight_num); - + //使用卡片布局管理器来管理多个页面 CardLayout c = new CardLayout(); panel.setLayout(c); + // 创建第一页乘客信息面板 JPanel p1 = new JPanel(); - p1.setBackground(new Color(72,46,115)); - p1.setPreferredSize(new Dimension(1200,680)); - p1.setLayout(null); - + p1.setBackground(new Color(72, 46, 115)); // 设置背景颜色为深紫色 + p1.setPreferredSize(new Dimension(1200, 680)); // 设置面板尺寸 + p1.setLayout(null); // 使用绝对布局 + // 创建页面标题标签,显示航班号 JLabel Head1 = new JLabel(Flight_num); - Head1.setBounds(450,10,300,50); - //外观设计 - Head1.setFont(new Font(Font.DIALOG,Font.BOLD,29));//设置文字字体 - Head1.setForeground(Color.white);//设置文字的颜色 - Head1.setOpaque(true); - Head1.setBackground(new Color(96, 62,151)); - Head1.setPreferredSize(new Dimension(300,50)); - Head1.setHorizontalAlignment(JLabel.CENTER); - - p1.add(Head1); - + Head1.setBounds(450, 10, 300, 50); // 设置位置和大小 + // 外观设计 + Head1.setFont(new Font(Font.DIALOG, Font.BOLD, 29)); // 设置字体样式和大小 + Head1.setForeground(Color.white); // 设置文字颜色为白色 + Head1.setOpaque(true); // 设置为不透明 + Head1.setBackground(new Color(96, 62, 151)); // 设置背景颜色 + Head1.setPreferredSize(new Dimension(300, 50)); // 设置首选尺寸 + Head1.setHorizontalAlignment(JLabel.CENTER); // 文字居中对齐 + + p1.add(Head1); // 将标题标签添加到面板中 + + // 创建"下一页"按钮 JButton button_right = new JButton("NEXT"); - button_right.setFont(new Font(Font.DIALOG,Font.BOLD,29));//设置文字字体 - button_right.setForeground(Color.white);//设置文字的颜色 - button_right.setBackground(new Color(96, 62,151)); - button_right.setSize(200,50); - button_right.setVisible(true); + button_right.setFont(new Font(Font.DIALOG, Font.BOLD, 29)); // 设置字体样式和大小 + button_right.setForeground(Color.white); // 设置文字颜色为白色 + button_right.setBackground(new Color(96, 62, 151)); // 设置背景颜色 + button_right.setSize(200, 50); // 设置按钮尺寸 + button_right.setVisible(true); // 设置按钮可见 JLabel label_right = new JLabel(); - label_right.setBounds(800,10,200,50); - //外观设计 - label_right.setOpaque(true); - label_right.setBackground(new Color(96, 62,151)); - label_right.setHorizontalAlignment(JLabel.CENTER); - label_right.add(button_right); - - p1.add(label_right); + label_right.setBounds(800, 10, 200, 50); // 设置位置和大小 + // 外观设计 + label_right.setOpaque(true); // 设置为不透明 + label_right.setBackground(new Color(96, 62, 151)); // 设置背景颜色 + label_right.setHorizontalAlignment(JLabel.CENTER); // 居中对齐 + label_right.add(button_right); // 将按钮添加到标签中 + p1.add(label_right); // 将标签添加到面板中 + // 创建中间信息显示面板 JPanel middlePanel1 = new JPanel(); - middlePanel1.setBounds(50,80,1100,500); - + middlePanel1.setBounds(50, 80, 1100, 500); // 设置位置和大小 + // 使用网格包布局管理器 GridBagLayout gbl1 = new GridBagLayout(); GridBagConstraints gbc1 = new GridBagConstraints(); middlePanel1.setLayout(gbl1); - gbc1.fill=GridBagConstraints.BOTH; - - - JLabel information11 = new JLabel("Name",SwingConstants.CENTER); - information11.setPreferredSize(new Dimension(220, 50)); - information11.setOpaque(true); - information11.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - information11.setForeground(Color.black);//设置文字的颜色 - information11.setBackground(new Color(252, 250, 250)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.1; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 0; - gbc1.gridy = 0; - gbl1.setConstraints(information11, gbc1); - middlePanel1.add(information11); - JLabel information12 = new JLabel("State", SwingConstants.CENTER); - information12.setPreferredSize(new Dimension(220, 50)); - information12.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - information12.setForeground(Color.black);//设置文字的颜色 - information12.setOpaque(true); - information12.setBackground(new Color(252, 250, 250)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.1; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 1; - gbc1.gridy = 0; - gbl1.setConstraints(information12, gbc1); - middlePanel1.add(information12); - JLabel information13 = new JLabel("Seats", SwingConstants.CENTER); - information13.setPreferredSize(new Dimension(220, 50)); - information13.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - information13.setForeground(Color.black);//设置文字的颜色 - information13.setOpaque(true); - information13.setBackground(new Color(252, 250, 250)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.1; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 2; - gbc1.gridy = 0; - gbl1.setConstraints(information13, gbc1); - middlePanel1.add(information13); - JLabel information14 = new JLabel("Foods", SwingConstants.CENTER); - information14.setPreferredSize(new Dimension(220, 50)); - information14.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - information14.setForeground(Color.black);//设置文字的颜色 - information14.setOpaque(true); - information14.setBackground(new Color(252, 250, 250)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.1; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 3; - gbc1.gridy = 0; - gbl1.setConstraints(information14, gbc1); - middlePanel1.add(information14); - JLabel information15 = new JLabel("Note", SwingConstants.CENTER); - information15.setPreferredSize(new Dimension(220, 50)); - information15.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - information15.setForeground(Color.black);//设置文字的颜色 - information15.setOpaque(true); - information15.setBackground(new Color(252, 250, 250)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.1; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 4; - gbc1.gridy = 0; - gbl1.setConstraints(information15, gbc1); - middlePanel1.add(information15); - - int LENGTH = 0; - - - String Name1_1 = ""; - String State1_1 =""; - String Seats1_1 =""; - String Foods1_1 =""; - String Note1_1 = ""; - if(passenger_num>=1) { + gbc1.fill = GridBagConstraints.BOTH; // 组件填充方式 + + // 创建表头标签 - 姓名列 + JLabel information11 = new JLabel("Name", SwingConstants.CENTER); + information11.setPreferredSize(new Dimension(220, 50)); // 设置首选尺寸 + information11.setOpaque(true); // 设置为不透明 + information11.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); // 设置字体 + information11.setForeground(Color.black); // 设置文字颜色 + information11.setBackground(new Color(252, 250, 250)); // 设置背景颜色 + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.1; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 0; // 设置网格位置 + gbc1.gridy = 0; + gbl1.setConstraints(information11, gbc1); + middlePanel1.add(information11); + + // 创建表头标签 - 状态列 + JLabel information12 = new JLabel("State", SwingConstants.CENTER); + information12.setPreferredSize(new Dimension(220, 50)); + information12.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + information12.setForeground(Color.black); + information12.setOpaque(true); + information12.setBackground(new Color(252, 250, 250)); + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.1; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 1; + gbc1.gridy = 0; + gbl1.setConstraints(information12, gbc1); + middlePanel1.add(information12); + + // 创建表头标签 - 座位列 + JLabel information13 = new JLabel("Seats", SwingConstants.CENTER); + information13.setPreferredSize(new Dimension(220, 50)); + information13.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + information13.setForeground(Color.black); + information13.setOpaque(true); + information13.setBackground(new Color(252, 250, 250)); + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.1; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 2; + gbc1.gridy = 0; + gbl1.setConstraints(information13, gbc1); + middlePanel1.add(information13); + + // 创建表头标签 - 餐食列 + JLabel information14 = new JLabel("Foods", SwingConstants.CENTER); + information14.setPreferredSize(new Dimension(220, 50)); + information14.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + information14.setForeground(Color.black); + information14.setOpaque(true); + information14.setBackground(new Color(252, 250, 250)); + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.1; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 3; + gbc1.gridy = 0; + gbl1.setConstraints(information14, gbc1); + middlePanel1.add(information14); + + // 创建表头标签 - 备注列 + JLabel information15 = new JLabel("Note", SwingConstants.CENTER); + information15.setPreferredSize(new Dimension(220, 50)); + information15.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + information15.setForeground(Color.black); + information15.setOpaque(true); + information15.setBackground(new Color(252, 250, 250)); + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.1; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 4; + gbc1.gridy = 0; + gbl1.setConstraints(information15, gbc1); + middlePanel1.add(information15); + + + // 初始化用于处理备注信息的长度变量 + int LENGTH = 0; + + // 声明第一页第一个乘客的信息变量 + String Name1_1 = ""; + String State1_1 = ""; + String Seats1_1 = ""; + String Foods1_1 = ""; + String Note1_1 = ""; + + // 如果乘客数量大于等于1,则处理第一个乘客的信息 + if (passenger_num >= 1) { + // 将第一个乘客的信息字符串按空格分割成数组 String[] information1_1 = information.get(0).split("\\s+"); + // 通过乘客订单对象获取乘客姓名 Name1_1 = po.findName(information1_1[0]); + // 获取乘客状态信息(索引为5) State1_1 = information1_1[5]; - if(!information1_1[3].equals("LETTERUNCHOSEN")&&!information1_1[4].equals("NUMBERUNCHOSEN")) { + // 如果座位字母和数字都已选择,则组合成完整座位号 + if (!information1_1[3].equals("LETTERUNCHOSEN") && !information1_1[4].equals("NUMBERUNCHOSEN")) { Seats1_1 = information1_1[3] + information1_1[4]; } - if(!information1_1[2].equals("FOODUNCHOSEN")){ + // 如果已选择餐食,则获取餐食信息 + if (!information1_1[2].equals("FOODUNCHOSEN")) { Foods1_1 = information1_1[2]; } - if(information1_1.length>9) { - LENGTH=information1_1.length; - while(LENGTH>=9) { - Note1_1 = information1_1[LENGTH-2]+" "+Note1_1; - LENGTH=LENGTH-1; + // 如果信息数组长度大于9,说明有备注信息需要处理 + if (information1_1.length > 9) { + LENGTH = information1_1.length; + // 循环处理备注信息,从后往前拼接 + while (LENGTH >= 9) { + Note1_1 = information1_1[LENGTH - 2] + " " + Note1_1; + LENGTH = LENGTH - 1; } - }else{ + } else { + // 如果信息数组长度不大于9,检查是否有备注信息 if (information1_1[7].equals("NOTE")) { - Note1_1 = ""; + Note1_1 = ""; // 没有备注信息 } else { - Note1_1 = information1_1[7]; + Note1_1 = information1_1[7]; // 获取备注信息 } } } - JLabel name1_1 = new JLabel(Name1_1,SwingConstants.CENTER); - name1_1.setPreferredSize(new Dimension(220, 45)); - name1_1.setOpaque(true); - name1_1.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - name1_1.setForeground(Color.black);//设置文字的颜色 - name1_1.setBackground(new Color(232, 232, 232)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 0; - gbc1.gridy = 1; - gbl1.setConstraints(name1_1, gbc1); - middlePanel1.add(name1_1); - JLabel state1_1 = new JLabel(State1_1, SwingConstants.CENTER); - state1_1.setPreferredSize(new Dimension(220, 45)); - state1_1.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - state1_1.setForeground(Color.black);//设置文字的颜色 - state1_1.setOpaque(true); - state1_1.setBackground(new Color(232, 232, 232)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 1; - gbc1.gridy = 1; - gbl1.setConstraints(state1_1, gbc1); - middlePanel1.add(state1_1); - JLabel seats1_1 = new JLabel(Seats1_1, SwingConstants.CENTER); - seats1_1.setPreferredSize(new Dimension(220, 45)); - seats1_1.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - seats1_1.setForeground(Color.black);//设置文字的颜色 - seats1_1.setOpaque(true); - seats1_1.setBackground(new Color(232, 232, 232)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 2; - gbc1.gridy = 1; - gbl1.setConstraints(seats1_1, gbc1); - middlePanel1.add(seats1_1); - JLabel foods1_1 = new JLabel(Foods1_1, SwingConstants.CENTER); - foods1_1.setPreferredSize(new Dimension(220, 45)); - foods1_1.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - foods1_1.setForeground(Color.black);//设置文字的颜色 - foods1_1.setOpaque(true); - foods1_1.setBackground(new Color(232, 232, 232)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 3; - gbc1.gridy = 1; - gbl1.setConstraints(foods1_1, gbc1); - middlePanel1.add(foods1_1); - JLabel note1_1 = new JLabel(Note1_1, SwingConstants.CENTER); - note1_1.setPreferredSize(new Dimension(220, 45)); - note1_1.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - note1_1.setForeground(Color.black);//设置文字的颜色 - note1_1.setOpaque(true); - note1_1.setBackground(new Color(232, 232, 232)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 4; - gbc1.gridy = 1; - gbl1.setConstraints(note1_1, gbc1); - middlePanel1.add(note1_1); + // 创建显示第一个乘客姓名的标签 + JLabel name1_1 = new JLabel(Name1_1, SwingConstants.CENTER); + name1_1.setPreferredSize(new Dimension(220, 45)); // 设置标签尺寸 + name1_1.setOpaque(true); // 设置为不透明 + name1_1.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); // 设置字体 + name1_1.setForeground(Color.black); // 设置文字颜色 + name1_1.setBackground(new Color(232, 232, 232)); // 设置背景颜色 + // 设置网格布局约束条件 + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 0; // 第0列 + gbc1.gridy = 1; // 第1行(表头下方第一行) + gbl1.setConstraints(name1_1, gbc1); + middlePanel1.add(name1_1); // 添加到中间面板 + + // 创建显示第一个乘客状态的标签 + JLabel state1_1 = new JLabel(State1_1, SwingConstants.CENTER); + state1_1.setPreferredSize(new Dimension(220, 45)); + state1_1.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + state1_1.setForeground(Color.black); + state1_1.setOpaque(true); + state1_1.setBackground(new Color(232, 232, 232)); + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 1; // 第1列 + gbc1.gridy = 1; // 第1行 + gbl1.setConstraints(state1_1, gbc1); + middlePanel1.add(state1_1); + + // 创建显示第一个乘客座位号的标签 + JLabel seats1_1 = new JLabel(Seats1_1, SwingConstants.CENTER); + seats1_1.setPreferredSize(new Dimension(220, 45)); + seats1_1.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + seats1_1.setForeground(Color.black); + seats1_1.setOpaque(true); + seats1_1.setBackground(new Color(232, 232, 232)); + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 2; // 第2列 + gbc1.gridy = 1; // 第1行 + gbl1.setConstraints(seats1_1, gbc1); + middlePanel1.add(seats1_1); + + // 创建显示第一个乘客餐食选择的标签 + JLabel foods1_1 = new JLabel(Foods1_1, SwingConstants.CENTER); + foods1_1.setPreferredSize(new Dimension(220, 45)); + foods1_1.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + foods1_1.setForeground(Color.black); + foods1_1.setOpaque(true); + foods1_1.setBackground(new Color(232, 232, 232)); + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 3; // 第3列 + gbc1.gridy = 1; // 第1行 + gbl1.setConstraints(foods1_1, gbc1); + middlePanel1.add(foods1_1); + + // 创建显示第一个乘客备注信息的标签 + JLabel note1_1 = new JLabel(Note1_1, SwingConstants.CENTER); + note1_1.setPreferredSize(new Dimension(220, 45)); + note1_1.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + note1_1.setForeground(Color.black); + note1_1.setOpaque(true); + note1_1.setBackground(new Color(232, 232, 232)); + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 4; // 第4列 + gbc1.gridy = 1; // 第1行 + gbl1.setConstraints(note1_1, gbc1); + middlePanel1.add(note1_1); + + +// 声明第一页第二个乘客的信息变量 String Name1_2 = ""; - String State1_2 =""; - String Seats1_2 =""; - String Foods1_2 =""; + String State1_2 = ""; + String Seats1_2 = ""; + String Foods1_2 = ""; String Note1_2 = ""; - if(passenger_num>=2) { + +// 如果乘客数量大于等于2,则处理第二个乘客的信息 + if (passenger_num >= 2) { + // 将第二个乘客的信息字符串按空格分割成数组 String[] information1_2 = information.get(1).split("\\s+"); + // 通过乘客订单对象获取乘客姓名 Name1_2 = po.findName(information1_2[0]); + // 获取乘客状态信息(索引为5) State1_2 = information1_2[5]; - if(!information1_2[3].equals("LETTERUNCHOSEN")&&!information1_2[4].equals("NUMBERUNCHOSEN")) { + // 如果座位字母和数字都已选择,则组合成完整座位号 + if (!information1_2[3].equals("LETTERUNCHOSEN") && !information1_2[4].equals("NUMBERUNCHOSEN")) { Seats1_2 = information1_2[3] + information1_2[4]; } - if(!information1_2[2].equals("FOODUNCHOSEN")){ + // 如果已选择餐食,则获取餐食信息 + if (!information1_2[2].equals("FOODUNCHOSEN")) { Foods1_2 = information1_2[2]; } - if(information1_2.length>9) { - LENGTH=information1_2.length; - while(LENGTH>=9) { - Note1_2 = information1_2[LENGTH-2]+" "+Note1_2; - LENGTH=LENGTH-1; + // 如果信息数组长度大于9,说明有备注信息需要处理 + if (information1_2.length > 9) { + LENGTH = information1_2.length; + // 循环处理备注信息,从后往前拼接 + while (LENGTH >= 9) { + Note1_2 = information1_2[LENGTH - 2] + " " + Note1_2; + LENGTH = LENGTH - 1; } - }else{ + } else { + // 如果信息数组长度不大于9,检查是否有备注信息 if (information1_2[7].equals("NOTE")) { - Note1_2 = ""; + Note1_2 = ""; // 没有备注信息 } else { - Note1_2 = information1_2[7]; + Note1_2 = information1_2[7]; // 获取备注信息 } } } - JLabel name1_2 = new JLabel(Name1_2,SwingConstants.CENTER); - name1_2.setPreferredSize(new Dimension(220, 45)); - name1_2.setOpaque(true); - name1_2.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - name1_2.setForeground(Color.black);//设置文字的颜色 - name1_2.setBackground(new Color(252, 250, 250)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 0; - gbc1.gridy = 2; - gbl1.setConstraints(name1_2, gbc1); - middlePanel1.add(name1_2); - JLabel state1_2 = new JLabel(State1_2, SwingConstants.CENTER); - state1_2.setPreferredSize(new Dimension(220, 45)); - state1_2.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - state1_2.setForeground(Color.black);//设置文字的颜色 - state1_2.setOpaque(true); - state1_2.setBackground(new Color(252, 250, 250)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 1; - gbc1.gridy = 2; - gbl1.setConstraints(state1_2, gbc1); - middlePanel1.add(state1_2); - JLabel seats1_2 = new JLabel(Seats1_2, SwingConstants.CENTER); - seats1_2.setPreferredSize(new Dimension(220, 45)); - seats1_2.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - seats1_2.setForeground(Color.black);//设置文字的颜色 - seats1_2.setOpaque(true); - seats1_2.setBackground(new Color(252, 250, 250)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 2; - gbc1.gridy = 2; - gbl1.setConstraints(seats1_2, gbc1); - middlePanel1.add(seats1_2); - JLabel foods1_2 = new JLabel(Foods1_2, SwingConstants.CENTER); - foods1_2.setPreferredSize(new Dimension(220, 45)); - foods1_2.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - foods1_2.setForeground(Color.black);//设置文字的颜色 - foods1_2.setOpaque(true); - foods1_2.setBackground(new Color(252, 250, 250)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 3; - gbc1.gridy = 2; - gbl1.setConstraints(foods1_2, gbc1); - middlePanel1.add(foods1_2); - JLabel note1_2 = new JLabel(Note1_2, SwingConstants.CENTER); - note1_2.setPreferredSize(new Dimension(220, 45)); - note1_2.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - note1_2.setForeground(Color.black);//设置文字的颜色 - note1_2.setOpaque(true); - note1_2.setBackground(new Color(252, 250, 250)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 4; - gbc1.gridy = 2; - gbl1.setConstraints(note1_2, gbc1); - middlePanel1.add(note1_2); +// 创建显示第二个乘客姓名的标签 + JLabel name1_2 = new JLabel(Name1_2, SwingConstants.CENTER); + name1_2.setPreferredSize(new Dimension(220, 45)); // 设置标签尺寸 + name1_2.setOpaque(true); // 设置为不透明 + name1_2.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); // 设置字体 + name1_2.setForeground(Color.black); // 设置文字颜色 + name1_2.setBackground(new Color(252, 250, 250)); // 设置背景颜色(浅灰色) +// 设置网格布局约束条件 + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 0; // 第0列 + gbc1.gridy = 2; // 第2行 + gbl1.setConstraints(name1_2, gbc1); + middlePanel1.add(name1_2); // 添加到中间面板 + +// 创建显示第二个乘客状态的标签 + JLabel state1_2 = new JLabel(State1_2, SwingConstants.CENTER); + state1_2.setPreferredSize(new Dimension(220, 45)); + state1_2.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + state1_2.setForeground(Color.black); + state1_2.setOpaque(true); + state1_2.setBackground(new Color(252, 250, 250)); + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 1; // 第1列 + gbc1.gridy = 2; // 第2行 + gbl1.setConstraints(state1_2, gbc1); + middlePanel1.add(state1_2); + +// 创建显示第二个乘客座位号的标签 + JLabel seats1_2 = new JLabel(Seats1_2, SwingConstants.CENTER); + seats1_2.setPreferredSize(new Dimension(220, 45)); + seats1_2.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + seats1_2.setForeground(Color.black); + seats1_2.setOpaque(true); + seats1_2.setBackground(new Color(252, 250, 250)); + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 2; // 第2列 + gbc1.gridy = 2; // 第2行 + gbl1.setConstraints(seats1_2, gbc1); + middlePanel1.add(seats1_2); + +// 创建显示第二个乘客餐食选择的标签 + JLabel foods1_2 = new JLabel(Foods1_2, SwingConstants.CENTER); + foods1_2.setPreferredSize(new Dimension(220, 45)); + foods1_2.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + foods1_2.setForeground(Color.black); + foods1_2.setOpaque(true); + foods1_2.setBackground(new Color(252, 250, 250)); + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 3; // 第3列 + gbc1.gridy = 2; // 第2行 + gbl1.setConstraints(foods1_2, gbc1); + middlePanel1.add(foods1_2); + +// 创建显示第二个乘客备注信息的标签 + JLabel note1_2 = new JLabel(Note1_2, SwingConstants.CENTER); + note1_2.setPreferredSize(new Dimension(220, 45)); + note1_2.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + note1_2.setForeground(Color.black); + note1_2.setOpaque(true); + note1_2.setBackground(new Color(252, 250, 250)); + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 4; // 第4列 + gbc1.gridy = 2; // 第2行 + gbl1.setConstraints(note1_2, gbc1); + middlePanel1.add(note1_2); + +// 声明第一页第三个乘客的信息变量 String Name1_3 = ""; - String State1_3 =""; - String Seats1_3 =""; - String Foods1_3 =""; + String State1_3 = ""; + String Seats1_3 = ""; + String Foods1_3 = ""; String Note1_3 = ""; - if(passenger_num>=3) { + +// 如果乘客数量大于等于3,则处理第三个乘客的信息 + if (passenger_num >= 3) { + // 将第三个乘客的信息字符串按空格分割成数组 String[] information1_3 = information.get(2).split("\\s+"); + // 通过乘客订单对象获取乘客姓名 Name1_3 = po.findName(information1_3[0]); + // 获取乘客状态信息(索引为5) State1_3 = information1_3[5]; - if(!information1_3[3].equals("LETTERUNCHOSEN")&&!information1_3[4].equals("NUMBERUNCHOSEN")) { + // 如果座位字母和数字都已选择,则组合成完整座位号 + if (!information1_3[3].equals("LETTERUNCHOSEN") && !information1_3[4].equals("NUMBERUNCHOSEN")) { Seats1_3 = information1_3[3] + information1_3[4]; } - if(!information1_3[2].equals("FOODUNCHOSEN")){ + // 如果已选择餐食,则获取餐食信息 + if (!information1_3[2].equals("FOODUNCHOSEN")) { Foods1_3 = information1_3[2]; } - if(information1_3.length>9) { - LENGTH=information1_3.length; - while(LENGTH>=9) { - Note1_3 = information1_3[LENGTH-2]+" "+Note1_3; - LENGTH=LENGTH-1; + // 如果信息数组长度大于9,说明有备注信息需要处理 + if (information1_3.length > 9) { + LENGTH = information1_3.length; + // 循环处理备注信息,从后往前拼接 + while (LENGTH >= 9) { + Note1_3 = information1_3[LENGTH - 2] + " " + Note1_3; + LENGTH = LENGTH - 1; } - }else{ + } else { + // 如果信息数组长度不大于9,检查是否有备注信息 if (information1_3[7].equals("NOTE")) { - Note1_3 = ""; + Note1_3 = ""; // 没有备注信息 } else { - Note1_3 = information1_3[7]; + Note1_3 = information1_3[7]; // 获取备注信息 } } } - JLabel name1_3 = new JLabel(Name1_3,SwingConstants.CENTER); - name1_3.setPreferredSize(new Dimension(220, 45)); - name1_3.setOpaque(true); - name1_3.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - name1_3.setForeground(Color.black);//设置文字的颜色 - name1_3.setBackground(new Color(232, 232, 232)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 0; - gbc1.gridy = 3; - gbl1.setConstraints(name1_3, gbc1); - middlePanel1.add(name1_3); - JLabel state1_3 = new JLabel(State1_3, SwingConstants.CENTER); - state1_3.setPreferredSize(new Dimension(220, 45)); - state1_3.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - state1_3.setForeground(Color.black);//设置文字的颜色 - state1_3.setOpaque(true); - state1_3.setBackground(new Color(232, 232, 232)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 1; - gbc1.gridy = 3; - gbl1.setConstraints(state1_3, gbc1); - middlePanel1.add(state1_3); - JLabel seats1_3 = new JLabel(Seats1_3, SwingConstants.CENTER); - seats1_3.setPreferredSize(new Dimension(220, 45)); - seats1_3.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - seats1_3.setForeground(Color.black);//设置文字的颜色 - seats1_3.setOpaque(true); - seats1_3.setBackground(new Color(232, 232, 232)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 2; - gbc1.gridy = 3; - gbl1.setConstraints(seats1_3, gbc1); - middlePanel1.add(seats1_3); - JLabel foods1_3 = new JLabel(Foods1_3, SwingConstants.CENTER); - foods1_3.setPreferredSize(new Dimension(220, 45)); - foods1_3.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - foods1_3.setForeground(Color.black);//设置文字的颜色 - foods1_3.setOpaque(true); - foods1_3.setBackground(new Color(232, 232, 232)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 3; - gbc1.gridy = 3; - gbl1.setConstraints(foods1_3, gbc1); - middlePanel1.add(foods1_3); - JLabel note1_3 = new JLabel(Note1_3, SwingConstants.CENTER); - note1_3.setPreferredSize(new Dimension(220, 45)); - note1_3.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - note1_3.setForeground(Color.black);//设置文字的颜色 - note1_3.setOpaque(true); - note1_3.setBackground(new Color(232, 232, 232)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 4; - gbc1.gridy = 3; - gbl1.setConstraints(note1_3, gbc1); - middlePanel1.add(note1_3); +// 创建显示第三个乘客姓名的标签 + JLabel name1_3 = new JLabel(Name1_3, SwingConstants.CENTER); + name1_3.setPreferredSize(new Dimension(220, 45)); // 设置标签尺寸 + name1_3.setOpaque(true); // 设置为不透明 + name1_3.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); // 设置字体 + name1_3.setForeground(Color.black); // 设置文字颜色 + name1_3.setBackground(new Color(232, 232, 232)); // 设置背景颜色(深灰色) +// 设置网格布局约束条件 + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 0; // 第0列 + gbc1.gridy = 3; // 第3行 + gbl1.setConstraints(name1_3, gbc1); + middlePanel1.add(name1_3); // 添加到中间面板 + +// 创建显示第三个乘客状态的标签 + JLabel state1_3 = new JLabel(State1_3, SwingConstants.CENTER); + state1_3.setPreferredSize(new Dimension(220, 45)); + state1_3.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + state1_3.setForeground(Color.black); + state1_3.setOpaque(true); + state1_3.setBackground(new Color(232, 232, 232)); + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 1; // 第1列 + gbc1.gridy = 3; // 第3行 + gbl1.setConstraints(state1_3, gbc1); + middlePanel1.add(state1_3); + +// 创建显示第三个乘客座位号的标签 + JLabel seats1_3 = new JLabel(Seats1_3, SwingConstants.CENTER); + seats1_3.setPreferredSize(new Dimension(220, 45)); + seats1_3.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + seats1_3.setForeground(Color.black); + seats1_3.setOpaque(true); + seats1_3.setBackground(new Color(232, 232, 232)); + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 2; // 第2列 + gbc1.gridy = 3; // 第3行 + gbl1.setConstraints(seats1_3, gbc1); + middlePanel1.add(seats1_3); + +// 创建显示第三个乘客餐食选择的标签 + JLabel foods1_3 = new JLabel(Foods1_3, SwingConstants.CENTER); + foods1_3.setPreferredSize(new Dimension(220, 45)); + foods1_3.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + foods1_3.setForeground(Color.black); + foods1_3.setOpaque(true); + foods1_3.setBackground(new Color(232, 232, 232)); + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 3; // 第3列 + gbc1.gridy = 3; // 第3行 + gbl1.setConstraints(foods1_3, gbc1); + middlePanel1.add(foods1_3); + +// 创建显示第三个乘客备注信息的标签 + JLabel note1_3 = new JLabel(Note1_3, SwingConstants.CENTER); + note1_3.setPreferredSize(new Dimension(220, 45)); + note1_3.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + note1_3.setForeground(Color.black); + note1_3.setOpaque(true); + note1_3.setBackground(new Color(232, 232, 232)); + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 4; // 第4列 + gbc1.gridy = 3; // 第3行 + gbl1.setConstraints(note1_3, gbc1); + middlePanel1.add(note1_3); + + // 声明第一页第四个乘客的信息变量 String Name1_4 = ""; - String State1_4 =""; - String Seats1_4 =""; - String Foods1_4 =""; + String State1_4 = ""; + String Seats1_4 = ""; + String Foods1_4 = ""; String Note1_4 = ""; - if(passenger_num>=4) { + +// 如果乘客数量大于等于4,则处理第四个乘客的信息 + if (passenger_num >= 4) { + // 将第四个乘客的信息字符串按空格分割成数组 String[] information1_4 = information.get(3).split("\\s+"); + // 通过乘客订单对象获取乘客姓名 Name1_4 = po.findName(information1_4[0]); + // 获取乘客状态信息(索引为5) State1_4 = information1_4[5]; - if(!information1_4[3].equals("LETTERUNCHOSEN")&&!information1_4[4].equals("NUMBERUNCHOSEN")) { + // 如果座位字母和数字都已选择,则组合成完整座位号 + if (!information1_4[3].equals("LETTERUNCHOSEN") && !information1_4[4].equals("NUMBERUNCHOSEN")) { Seats1_4 = information1_4[3] + information1_4[4]; } - if(!information1_4[2].equals("FOODUNCHOSEN")){ + // 如果已选择餐食,则获取餐食信息 + if (!information1_4[2].equals("FOODUNCHOSEN")) { Foods1_4 = information1_4[2]; } - if(information1_4.length>9) { - LENGTH=information1_4.length; - while(LENGTH>=9) { - Note1_4 = information1_4[LENGTH-2]+" "+Note1_4; - LENGTH=LENGTH-1; + // 如果信息数组长度大于9,说明有备注信息需要处理 + if (information1_4.length > 9) { + LENGTH = information1_4.length; + // 循环处理备注信息,从后往前拼接 + while (LENGTH >= 9) { + Note1_4 = information1_4[LENGTH - 2] + " " + Note1_4; + LENGTH = LENGTH - 1; } - }else{ + } else { + // 如果信息数组长度不大于9,检查是否有备注信息 if (information1_4[7].equals("NOTE")) { - Note1_4 = ""; + Note1_4 = ""; // 没有备注信息 } else { - Note1_4 = information1_4[7]; + Note1_4 = information1_4[7]; // 获取备注信息 } } } - JLabel name1_4 = new JLabel(Name1_4,SwingConstants.CENTER); - name1_4.setPreferredSize(new Dimension(220, 45)); - name1_4.setOpaque(true); - name1_4.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - name1_4.setForeground(Color.black);//设置文字的颜色 - name1_4.setBackground(new Color(252, 250, 250)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 0; - gbc1.gridy = 4; - gbl1.setConstraints(name1_4, gbc1); - middlePanel1.add(name1_4); - JLabel state1_4 = new JLabel(State1_4, SwingConstants.CENTER); - state1_4.setPreferredSize(new Dimension(220, 45)); - state1_4.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - state1_4.setForeground(Color.black);//设置文字的颜色 - state1_4.setOpaque(true); - state1_4.setBackground(new Color(252, 250, 250)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 1; - gbc1.gridy = 4; - gbl1.setConstraints(state1_4, gbc1); - middlePanel1.add(state1_4); - JLabel seats1_4 = new JLabel(Seats1_4, SwingConstants.CENTER); - seats1_4.setPreferredSize(new Dimension(220, 45)); - seats1_4.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - seats1_4.setForeground(Color.black);//设置文字的颜色 - seats1_4.setOpaque(true); - seats1_4.setBackground(new Color(252, 250, 250)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 2; - gbc1.gridy = 4; - gbl1.setConstraints(seats1_4, gbc1); - middlePanel1.add(seats1_4); - JLabel foods1_4 = new JLabel(Foods1_4, SwingConstants.CENTER); - foods1_4.setPreferredSize(new Dimension(220, 45)); - foods1_4.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - foods1_4.setForeground(Color.black);//设置文字的颜色 - foods1_4.setOpaque(true); - foods1_4.setBackground(new Color(252, 250, 250)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 3; - gbc1.gridy = 4; - gbl1.setConstraints(foods1_4, gbc1); - middlePanel1.add(foods1_4); - JLabel note1_4 = new JLabel(Note1_4, SwingConstants.CENTER); - note1_4.setPreferredSize(new Dimension(220, 45)); - note1_4.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - note1_4.setForeground(Color.black);//设置文字的颜色 - note1_4.setOpaque(true); - note1_4.setBackground(new Color(252, 250, 250)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 4; - gbc1.gridy = 4; - gbl1.setConstraints(note1_4, gbc1); - middlePanel1.add(note1_4); +// 创建显示第四个乘客姓名的标签 + JLabel name1_4 = new JLabel(Name1_4, SwingConstants.CENTER); + name1_4.setPreferredSize(new Dimension(220, 45)); // 设置标签尺寸 + name1_4.setOpaque(true); // 设置为不透明 + name1_4.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); // 设置字体 + name1_4.setForeground(Color.black); // 设置文字颜色 + name1_4.setBackground(new Color(252, 250, 250)); // 设置背景颜色(浅灰色) +// 设置网格布局约束条件 + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 0; // 第0列 + gbc1.gridy = 4; // 第4行 + gbl1.setConstraints(name1_4, gbc1); + middlePanel1.add(name1_4); // 添加到中间面板 + +// 创建显示第四个乘客状态的标签 + JLabel state1_4 = new JLabel(State1_4, SwingConstants.CENTER); + state1_4.setPreferredSize(new Dimension(220, 45)); + state1_4.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + state1_4.setForeground(Color.black); + state1_4.setOpaque(true); + state1_4.setBackground(new Color(252, 250, 250)); + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 1; // 第1列 + gbc1.gridy = 4; // 第4行 + gbl1.setConstraints(state1_4, gbc1); + middlePanel1.add(state1_4); + +// 创建显示第四个乘客座位号的标签 + JLabel seats1_4 = new JLabel(Seats1_4, SwingConstants.CENTER); + seats1_4.setPreferredSize(new Dimension(220, 45)); + seats1_4.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + seats1_4.setForeground(Color.black); + seats1_4.setOpaque(true); + seats1_4.setBackground(new Color(252, 250, 250)); + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 2; // 第2列 + gbc1.gridy = 4; // 第4行 + gbl1.setConstraints(seats1_4, gbc1); + middlePanel1.add(seats1_4); + +// 创建显示第四个乘客餐食选择的标签 + JLabel foods1_4 = new JLabel(Foods1_4, SwingConstants.CENTER); + foods1_4.setPreferredSize(new Dimension(220, 45)); + foods1_4.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + foods1_4.setForeground(Color.black); + foods1_4.setOpaque(true); + foods1_4.setBackground(new Color(252, 250, 250)); + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 3; // 第3列 + gbc1.gridy = 4; // 第4行 + gbl1.setConstraints(foods1_4, gbc1); + middlePanel1.add(foods1_4); + +// 创建显示第四个乘客备注信息的标签 + JLabel note1_4 = new JLabel(Note1_4, SwingConstants.CENTER); + note1_4.setPreferredSize(new Dimension(220, 45)); + note1_4.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + note1_4.setForeground(Color.black); + note1_4.setOpaque(true); + note1_4.setBackground(new Color(252, 250, 250)); + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 4; // 第4列 + gbc1.gridy = 4; // 第4行 + gbl1.setConstraints(note1_4, gbc1); + middlePanel1.add(note1_4); + +// 声明第一页第五个乘客的信息变量 String Name1_5 = ""; - String State1_5 =""; - String Seats1_5 =""; - String Foods1_5 =""; + String State1_5 = ""; + String Seats1_5 = ""; + String Foods1_5 = ""; String Note1_5 = ""; - if(passenger_num>=5) { + +// 如果乘客数量大于等于5,则处理第五个乘客的信息 + if (passenger_num >= 5) { + // 将第五个乘客的信息字符串按空格分割成数组 String[] information1_5 = information.get(4).split("\\s+"); + // 通过乘客订单对象获取乘客姓名 Name1_5 = po.findName(information1_5[0]); + // 获取乘客状态信息(索引为5) State1_5 = information1_5[5]; - if(!information1_5[3].equals("LETTERUNCHOSEN")&&!information1_5[4].equals("NUMBERUNCHOSEN")) { + // 如果座位字母和数字都已选择,则组合成完整座位号 + if (!information1_5[3].equals("LETTERUNCHOSEN") && !information1_5[4].equals("NUMBERUNCHOSEN")) { Seats1_5 = information1_5[3] + information1_5[4]; } - if(!information1_5[2].equals("FOODUNCHOSEN")){ + // 如果已选择餐食,则获取餐食信息 + if (!information1_5[2].equals("FOODUNCHOSEN")) { Foods1_5 = information1_5[2]; } - if(information1_5.length>9) { - LENGTH=information1_5.length; - while(LENGTH>=9) { - Note1_5 = information1_5[LENGTH-2]+" "+Note1_5; - LENGTH=LENGTH-1; + // 如果信息数组长度大于9,说明有备注信息需要处理 + if (information1_5.length > 9) { + LENGTH = information1_5.length; + // 循环处理备注信息,从后往前拼接 + while (LENGTH >= 9) { + Note1_5 = information1_5[LENGTH - 2] + " " + Note1_5; + LENGTH = LENGTH - 1; } - }else{ + } else { + // 如果信息数组长度不大于9,检查是否有备注信息 if (information1_5[7].equals("NOTE")) { - Note1_5 = ""; + Note1_5 = ""; // 没有备注信息 } else { - Note1_5 = information1_5[7]; + Note1_5 = information1_5[7]; // 获取备注信息 } } } - JLabel name1_5 = new JLabel(Name1_5,SwingConstants.CENTER); - name1_5.setPreferredSize(new Dimension(220, 45)); - name1_5.setOpaque(true); - name1_5.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - name1_5.setForeground(Color.black);//设置文字的颜色 - name1_5.setBackground(new Color(232, 232, 232)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 0; - gbc1.gridy = 5; - gbl1.setConstraints(name1_5, gbc1); - middlePanel1.add(name1_5); - JLabel state1_5 = new JLabel(State1_5, SwingConstants.CENTER); - state1_5.setPreferredSize(new Dimension(220, 45)); - state1_5.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - state1_5.setForeground(Color.black);//设置文字的颜色 - state1_5.setOpaque(true); - state1_5.setBackground(new Color(232, 232, 232)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 1; - gbc1.gridy = 5; - gbl1.setConstraints(state1_5, gbc1); - middlePanel1.add(state1_5); - JLabel seats1_5 = new JLabel(Seats1_5, SwingConstants.CENTER); - seats1_5.setPreferredSize(new Dimension(220, 45)); - seats1_5.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - seats1_5.setForeground(Color.black);//设置文字的颜色 - seats1_5.setOpaque(true); - seats1_5.setBackground(new Color(232, 232, 232)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 2; - gbc1.gridy = 5; - gbl1.setConstraints(seats1_5, gbc1); - middlePanel1.add(seats1_5); - JLabel foods1_5 = new JLabel(Foods1_5, SwingConstants.CENTER); - foods1_5.setPreferredSize(new Dimension(220, 45)); - foods1_5.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - foods1_5.setForeground(Color.black);//设置文字的颜色 - foods1_5.setOpaque(true); - foods1_5.setBackground(new Color(232, 232, 232)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 3; - gbc1.gridy = 5; - gbl1.setConstraints(foods1_5, gbc1); - middlePanel1.add(foods1_5); - JLabel note1_5 = new JLabel(Note1_5, SwingConstants.CENTER); - note1_5.setPreferredSize(new Dimension(220, 45)); - note1_5.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - note1_5.setForeground(Color.black);//设置文字的颜色 - note1_5.setOpaque(true); - note1_5.setBackground(new Color(232, 232, 232)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 4; - gbc1.gridy = 5; - gbl1.setConstraints(note1_5, gbc1); - middlePanel1.add(note1_5); +// 创建显示第五个乘客姓名的标签 + JLabel name1_5 = new JLabel(Name1_5, SwingConstants.CENTER); + name1_5.setPreferredSize(new Dimension(220, 45)); // 设置标签尺寸 + name1_5.setOpaque(true); // 设置为不透明 + name1_5.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); // 设置字体 + name1_5.setForeground(Color.black); // 设置文字颜色 + name1_5.setBackground(new Color(232, 232, 232)); // 设置背景颜色(深灰色) +// 设置网格布局约束条件 + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 0; // 第0列 + gbc1.gridy = 5; // 第5行 + gbl1.setConstraints(name1_5, gbc1); + middlePanel1.add(name1_5); // 添加到中间面板 + +// 创建显示第五个乘客状态的标签 + JLabel state1_5 = new JLabel(State1_5, SwingConstants.CENTER); + state1_5.setPreferredSize(new Dimension(220, 45)); + state1_5.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + state1_5.setForeground(Color.black); + state1_5.setOpaque(true); + state1_5.setBackground(new Color(232, 232, 232)); + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 1; // 第1列 + gbc1.gridy = 5; // 第5行 + gbl1.setConstraints(state1_5, gbc1); + middlePanel1.add(state1_5); + +// 创建显示第五个乘客座位号的标签 + JLabel seats1_5 = new JLabel(Seats1_5, SwingConstants.CENTER); + seats1_5.setPreferredSize(new Dimension(220, 45)); + seats1_5.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + seats1_5.setForeground(Color.black); + seats1_5.setOpaque(true); + seats1_5.setBackground(new Color(232, 232, 232)); + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 2; // 第2列 + gbc1.gridy = 5; // 第5行 + gbl1.setConstraints(seats1_5, gbc1); + middlePanel1.add(seats1_5); + +// 创建显示第五个乘客餐食选择的标签 + JLabel foods1_5 = new JLabel(Foods1_5, SwingConstants.CENTER); + foods1_5.setPreferredSize(new Dimension(220, 45)); + foods1_5.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + foods1_5.setForeground(Color.black); + foods1_5.setOpaque(true); + foods1_5.setBackground(new Color(232, 232, 232)); + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 3; // 第3列 + gbc1.gridy = 5; // 第5行 + gbl1.setConstraints(foods1_5, gbc1); + middlePanel1.add(foods1_5); + +// 创建显示第五个乘客备注信息的标签 + JLabel note1_5 = new JLabel(Note1_5, SwingConstants.CENTER); + note1_5.setPreferredSize(new Dimension(220, 45)); + note1_5.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + note1_5.setForeground(Color.black); + note1_5.setOpaque(true); + note1_5.setBackground(new Color(232, 232, 232)); + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 4; // 第4列 + gbc1.gridy = 5; // 第5行 + gbl1.setConstraints(note1_5, gbc1); + middlePanel1.add(note1_5); + + + // 声明第一页第六个乘客的信息变量 String Name1_6 = ""; - String State1_6 =""; - String Seats1_6 =""; - String Foods1_6 =""; + String State1_6 = ""; + String Seats1_6 = ""; + String Foods1_6 = ""; String Note1_6 = ""; - if(passenger_num>=6) { + +// 如果乘客数量大于等于6,则处理第六个乘客的信息 + if (passenger_num >= 6) { + // 将第六个乘客的信息字符串按空格分割成数组 String[] information1_6 = information.get(5).split("\\s+"); + // 通过乘客订单对象获取乘客姓名 Name1_6 = po.findName(information1_6[0]); + // 获取乘客状态信息(索引为5) State1_6 = information1_6[5]; - if(!information1_6[3].equals("LETTERUNCHOSEN")&&!information1_6[4].equals("NUMBERUNCHOSEN")) { + // 如果座位字母和数字都已选择,则组合成完整座位号 + if (!information1_6[3].equals("LETTERUNCHOSEN") && !information1_6[4].equals("NUMBERUNCHOSEN")) { Seats1_6 = information1_6[3] + information1_6[4]; } - if(!information1_6[2].equals("FOODUNCHOSEN")){ + // 如果已选择餐食,则获取餐食信息 + if (!information1_6[2].equals("FOODUNCHOSEN")) { Foods1_6 = information1_6[2]; } - if(information1_6.length>9) { - LENGTH=information1_6.length; - while(LENGTH>=9) { - Note1_6 = information1_6[LENGTH-2]+" "+Note1_6; - LENGTH=LENGTH-1; + // 如果信息数组长度大于9,说明有备注信息需要处理 + if (information1_6.length > 9) { + LENGTH = information1_6.length; + // 循环处理备注信息,从后往前拼接 + while (LENGTH >= 9) { + Note1_6 = information1_6[LENGTH - 2] + " " + Note1_6; + LENGTH = LENGTH - 1; } - }else{ + } else { + // 如果信息数组长度不大于9,检查是否有备注信息 if (information1_6[7].equals("NOTE")) { - Note1_6 = ""; + Note1_6 = ""; // 没有备注信息 } else { - Note1_6 = information1_6[7]; + Note1_6 = information1_6[7]; // 获取备注信息 } } } - JLabel name1_6 = new JLabel(Name1_6,SwingConstants.CENTER); - name1_6.setPreferredSize(new Dimension(220, 45)); - name1_6.setOpaque(true); - name1_6.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - name1_6.setForeground(Color.black);//设置文字的颜色 - name1_6.setBackground(new Color(252, 250, 250)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 0; - gbc1.gridy = 6; - gbl1.setConstraints(name1_6, gbc1); - middlePanel1.add(name1_6); - JLabel state1_6 = new JLabel(State1_6, SwingConstants.CENTER); - state1_6.setPreferredSize(new Dimension(220, 45)); - state1_6.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - state1_6.setForeground(Color.black);//设置文字的颜色 - state1_6.setOpaque(true); - state1_6.setBackground(new Color(252, 250, 250)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 1; - gbc1.gridy = 6; - gbl1.setConstraints(state1_6, gbc1); - middlePanel1.add(state1_6); - JLabel seats1_6 = new JLabel(Seats1_6, SwingConstants.CENTER); - seats1_6.setPreferredSize(new Dimension(220, 45)); - seats1_6.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - seats1_6.setForeground(Color.black);//设置文字的颜色 - seats1_6.setOpaque(true); - seats1_6.setBackground(new Color(252, 250, 250)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 2; - gbc1.gridy = 6; - gbl1.setConstraints(seats1_6, gbc1); - middlePanel1.add(seats1_6); - JLabel foods1_6 = new JLabel(Foods1_6, SwingConstants.CENTER); - foods1_6.setPreferredSize(new Dimension(220, 45)); - foods1_6.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - foods1_6.setForeground(Color.black);//设置文字的颜色 - foods1_6.setOpaque(true); - foods1_6.setBackground(new Color(252, 250, 250)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 3; - gbc1.gridy = 6; - gbl1.setConstraints(foods1_6, gbc1); - middlePanel1.add(foods1_6); - JLabel note1_6 = new JLabel(Note1_6, SwingConstants.CENTER); - note1_6.setPreferredSize(new Dimension(220, 45)); - note1_6.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - note1_6.setForeground(Color.black);//设置文字的颜色 - note1_6.setOpaque(true); - note1_6.setBackground(new Color(252, 250, 250)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 4; - gbc1.gridy = 6; - gbl1.setConstraints(note1_6, gbc1); - middlePanel1.add(note1_6); - +// 创建显示第六个乘客姓名的标签 + JLabel name1_6 = new JLabel(Name1_6, SwingConstants.CENTER); + name1_6.setPreferredSize(new Dimension(220, 45)); // 设置标签尺寸 + name1_6.setOpaque(true); // 设置为不透明 + name1_6.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); // 设置字体 + name1_6.setForeground(Color.black); // 设置文字颜色 + name1_6.setBackground(new Color(252, 250, 250)); // 设置背景颜色(浅灰色) +// 设置网格布局约束条件 + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 0; // 第0列 + gbc1.gridy = 6; // 第6行 + gbl1.setConstraints(name1_6, gbc1); + middlePanel1.add(name1_6); // 添加到中间面板 + +// 创建显示第六个乘客状态的标签 + JLabel state1_6 = new JLabel(State1_6, SwingConstants.CENTER); + state1_6.setPreferredSize(new Dimension(220, 45)); + state1_6.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + state1_6.setForeground(Color.black); + state1_6.setOpaque(true); + state1_6.setBackground(new Color(252, 250, 250)); + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 1; // 第1列 + gbc1.gridy = 6; // 第6行 + gbl1.setConstraints(state1_6, gbc1); + middlePanel1.add(state1_6); + +// 创建显示第六个乘客座位号的标签 + JLabel seats1_6 = new JLabel(Seats1_6, SwingConstants.CENTER); + seats1_6.setPreferredSize(new Dimension(220, 45)); + seats1_6.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + seats1_6.setForeground(Color.black); + seats1_6.setOpaque(true); + seats1_6.setBackground(new Color(252, 250, 250)); + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 2; // 第2列 + gbc1.gridy = 6; // 第6行 + gbl1.setConstraints(seats1_6, gbc1); + middlePanel1.add(seats1_6); + +// 创建显示第六个乘客餐食选择的标签 + JLabel foods1_6 = new JLabel(Foods1_6, SwingConstants.CENTER); + foods1_6.setPreferredSize(new Dimension(220, 45)); + foods1_6.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + foods1_6.setForeground(Color.black); + foods1_6.setOpaque(true); + foods1_6.setBackground(new Color(252, 250, 250)); + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 3; // 第3列 + gbc1.gridy = 6; // 第6行 + gbl1.setConstraints(foods1_6, gbc1); + middlePanel1.add(foods1_6); + +// 创建显示第六个乘客备注信息的标签 + JLabel note1_6 = new JLabel(Note1_6, SwingConstants.CENTER); + note1_6.setPreferredSize(new Dimension(220, 45)); + note1_6.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + note1_6.setForeground(Color.black); + note1_6.setOpaque(true); + note1_6.setBackground(new Color(252, 250, 250)); + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 4; // 第4列 + gbc1.gridy = 6; // 第6行 + gbl1.setConstraints(note1_6, gbc1); + middlePanel1.add(note1_6); + +// 声明第一页第七个乘客的信息变量 String Name1_7 = ""; - String State1_7 =""; - String Seats1_7 =""; - String Foods1_7 =""; + String State1_7 = ""; + String Seats1_7 = ""; + String Foods1_7 = ""; String Note1_7 = ""; - if(passenger_num>=7) { + +// 如果乘客数量大于等于7,则处理第七个乘客的信息 + if (passenger_num >= 7) { + // 将第七个乘客的信息字符串按空格分割成数组 String[] information1_7 = information.get(6).split("\\s+"); + // 通过乘客订单对象获取乘客姓名 Name1_7 = po.findName(information1_7[0]); + // 获取乘客状态信息(索引为5) State1_7 = information1_7[5]; - if(!information1_7[3].equals("LETTERUNCHOSEN")&&!information1_7[4].equals("NUMBERUNCHOSEN")) { + // 如果座位字母和数字都已选择,则组合成完整座位号 + if (!information1_7[3].equals("LETTERUNCHOSEN") && !information1_7[4].equals("NUMBERUNCHOSEN")) { Seats1_7 = information1_7[3] + information1_7[4]; } - if(!information1_7[2].equals("FOODUNCHOSEN")){ + // 如果已选择餐食,则获取餐食信息 + if (!information1_7[2].equals("FOODUNCHOSEN")) { Foods1_7 = information1_7[2]; } - if(information1_7.length>9) { - LENGTH=information1_7.length; - while(LENGTH>=9) { - Note1_7 = information1_7[LENGTH-2]+" "+Note1_7; - LENGTH=LENGTH-1; + // 如果信息数组长度大于9,说明有备注信息需要处理 + if (information1_7.length > 9) { + LENGTH = information1_7.length; + // 循环处理备注信息,从后往前拼接 + while (LENGTH >= 9) { + Note1_7 = information1_7[LENGTH - 2] + " " + Note1_7; + LENGTH = LENGTH - 1; } - }else{ + } else { + // 如果信息数组长度不大于9,检查是否有备注信息 if (information1_7[7].equals("NOTE")) { - Note1_7 = ""; + Note1_7 = ""; // 没有备注信息 } else { - Note1_7 = information1_7[7]; + Note1_7 = information1_7[7]; // 获取备注信息 } } } - JLabel name1_7 = new JLabel(Name1_7,SwingConstants.CENTER); - name1_7.setPreferredSize(new Dimension(220, 45)); - name1_7.setOpaque(true); - name1_7.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - name1_7.setForeground(Color.black);//设置文字的颜色 - name1_7.setBackground(new Color(232, 232, 232)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 0; - gbc1.gridy = 7; - gbl1.setConstraints(name1_7, gbc1); - middlePanel1.add(name1_7); - JLabel state1_7 = new JLabel(State1_7, SwingConstants.CENTER); - state1_7.setPreferredSize(new Dimension(220, 45)); - state1_7.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - state1_7.setForeground(Color.black);//设置文字的颜色 - state1_7.setOpaque(true); - state1_7.setBackground(new Color(232, 232, 232)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 1; - gbc1.gridy = 7; - gbl1.setConstraints(state1_7, gbc1); - middlePanel1.add(state1_7); - JLabel seats1_7 = new JLabel(Seats1_7, SwingConstants.CENTER); - seats1_7.setPreferredSize(new Dimension(220, 45)); - seats1_7.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - seats1_7.setForeground(Color.black);//设置文字的颜色 - seats1_7.setOpaque(true); - seats1_7.setBackground(new Color(232, 232, 232)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 2; - gbc1.gridy = 7; - gbl1.setConstraints(seats1_7, gbc1); - middlePanel1.add(seats1_7); - JLabel foods1_7 = new JLabel(Foods1_7, SwingConstants.CENTER); - foods1_7.setPreferredSize(new Dimension(220, 45)); - foods1_7.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - foods1_7.setForeground(Color.black);//设置文字的颜色 - foods1_7.setOpaque(true); - foods1_7.setBackground(new Color(232, 232, 232)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 3; - gbc1.gridy = 7; - gbl1.setConstraints(foods1_7, gbc1); - middlePanel1.add(foods1_7); - JLabel note1_7 = new JLabel(Note1_7, SwingConstants.CENTER); - note1_7.setPreferredSize(new Dimension(220, 45)); - note1_7.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - note1_7.setForeground(Color.black);//设置文字的颜色 - note1_7.setOpaque(true); - note1_7.setBackground(new Color(232, 232, 232)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 4; - gbc1.gridy = 7; - gbl1.setConstraints(note1_7, gbc1); - middlePanel1.add(note1_7); +// 创建显示第七个乘客姓名的标签 + JLabel name1_7 = new JLabel(Name1_7, SwingConstants.CENTER); + name1_7.setPreferredSize(new Dimension(220, 45)); // 设置标签尺寸 + name1_7.setOpaque(true); // 设置为不透明 + name1_7.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); // 设置字体 + name1_7.setForeground(Color.black); // 设置文字颜色 + name1_7.setBackground(new Color(232, 232, 232)); // 设置背景颜色(深灰色) +// 设置网格布局约束条件 + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 0; // 第0列 + gbc1.gridy = 7; // 第7行 + gbl1.setConstraints(name1_7, gbc1); + middlePanel1.add(name1_7); // 添加到中间面板 + +// 创建显示第七个乘客状态的标签 + JLabel state1_7 = new JLabel(State1_7, SwingConstants.CENTER); + state1_7.setPreferredSize(new Dimension(220, 45)); + state1_7.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + state1_7.setForeground(Color.black); + state1_7.setOpaque(true); + state1_7.setBackground(new Color(232, 232, 232)); + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 1; // 第1列 + gbc1.gridy = 7; // 第7行 + gbl1.setConstraints(state1_7, gbc1); + middlePanel1.add(state1_7); + +// 创建显示第七个乘客座位号的标签 + JLabel seats1_7 = new JLabel(Seats1_7, SwingConstants.CENTER); + seats1_7.setPreferredSize(new Dimension(220, 45)); + seats1_7.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + seats1_7.setForeground(Color.black); + seats1_7.setOpaque(true); + seats1_7.setBackground(new Color(232, 232, 232)); + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 2; // 第2列 + gbc1.gridy = 7; // 第7行 + gbl1.setConstraints(seats1_7, gbc1); + middlePanel1.add(seats1_7); + +// 创建显示第七个乘客餐食选择的标签 + JLabel foods1_7 = new JLabel(Foods1_7, SwingConstants.CENTER); + foods1_7.setPreferredSize(new Dimension(220, 45)); + foods1_7.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + foods1_7.setForeground(Color.black); + foods1_7.setOpaque(true); + foods1_7.setBackground(new Color(232, 232, 232)); + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 3; // 第3列 + gbc1.gridy = 7; // 第7行 + gbl1.setConstraints(foods1_7, gbc1); + middlePanel1.add(foods1_7); + +// 创建显示第七个乘客备注信息的标签 + JLabel note1_7 = new JLabel(Note1_7, SwingConstants.CENTER); + note1_7.setPreferredSize(new Dimension(220, 45)); + note1_7.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + note1_7.setForeground(Color.black); + note1_7.setOpaque(true); + note1_7.setBackground(new Color(232, 232, 232)); + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 4; // 第4列 + gbc1.gridy = 7; // 第7行 + gbl1.setConstraints(note1_7, gbc1); + middlePanel1.add(note1_7); + +// 声明第一页第八个乘客的信息变量 String Name1_8 = ""; - String State1_8 =""; - String Seats1_8 =""; - String Foods1_8 =""; + String State1_8 = ""; + String Seats1_8 = ""; + String Foods1_8 = ""; String Note1_8 = ""; - if(passenger_num>=8) { + +// 如果乘客数量大于等于8,则处理第八个乘客的信息 + if (passenger_num >= 8) { + // 将第八个乘客的信息字符串按空格分割成数组 String[] information1_8 = information.get(7).split("\\s+"); + // 通过乘客订单对象获取乘客姓名 Name1_8 = po.findName(information1_8[0]); + // 获取乘客状态信息(索引为5) State1_8 = information1_8[5]; - if(!information1_8[3].equals("LETTERUNCHOSEN")&&!information1_8[4].equals("NUMBERUNCHOSEN")) { + // 如果座位字母和数字都已选择,则组合成完整座位号 + if (!information1_8[3].equals("LETTERUNCHOSEN") && !information1_8[4].equals("NUMBERUNCHOSEN")) { Seats1_8 = information1_8[3] + information1_8[4]; } - if(!information1_8[2].equals("FOODUNCHOSEN")){ + // 如果已选择餐食,则获取餐食信息 + if (!information1_8[2].equals("FOODUNCHOSEN")) { Foods1_8 = information1_8[2]; } - if(information1_8.length>9) { - LENGTH=information1_8.length; - while(LENGTH>=9) { - Note1_8 = information1_8[LENGTH-2]+" "+Note1_8; - LENGTH=LENGTH-1; + // 如果信息数组长度大于9,说明有备注信息需要处理 + if (information1_8.length > 9) { + LENGTH = information1_8.length; + // 循环处理备注信息,从后往前拼接 + while (LENGTH >= 9) { + Note1_8 = information1_8[LENGTH - 2] + " " + Note1_8; + LENGTH = LENGTH - 1; } - }else{ + } else { + // 如果信息数组长度不大于9,检查是否有备注信息 if (information1_8[7].equals("NOTE")) { - Note1_8 = ""; + Note1_8 = ""; // 没有备注信息 } else { - Note1_8 = information1_8[7]; + Note1_8 = information1_8[7]; // 获取备注信息 } } } - JLabel name1_8 = new JLabel(Name1_8,SwingConstants.CENTER); - name1_8.setPreferredSize(new Dimension(220, 45)); - name1_8.setOpaque(true); - name1_8.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - name1_8.setForeground(Color.black);//设置文字的颜色 - name1_8.setBackground(new Color(252, 250, 250)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 0; - gbc1.gridy = 8; - gbl1.setConstraints(name1_8, gbc1); - middlePanel1.add(name1_8); - JLabel state1_8 = new JLabel(State1_8, SwingConstants.CENTER); - state1_8.setPreferredSize(new Dimension(220, 45)); - state1_8.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - state1_8.setForeground(Color.black);//设置文字的颜色 - state1_8.setOpaque(true); - state1_8.setBackground(new Color(252, 250, 250)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 1; - gbc1.gridy = 8; - gbl1.setConstraints(state1_8, gbc1); - middlePanel1.add(state1_8); - JLabel seats1_8 = new JLabel(Seats1_8, SwingConstants.CENTER); - seats1_8.setPreferredSize(new Dimension(220, 45)); - seats1_8.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - seats1_8.setForeground(Color.black);//设置文字的颜色 - seats1_8.setOpaque(true); - seats1_8.setBackground(new Color(252, 250, 250)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 2; - gbc1.gridy = 8; - gbl1.setConstraints(seats1_8, gbc1); - middlePanel1.add(seats1_8); - JLabel foods1_8 = new JLabel(Foods1_8, SwingConstants.CENTER); - foods1_8.setPreferredSize(new Dimension(220, 45)); - foods1_8.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - foods1_8.setForeground(Color.black);//设置文字的颜色 - foods1_8.setOpaque(true); - foods1_8.setBackground(new Color(252, 250, 250)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 3; - gbc1.gridy = 8; - gbl1.setConstraints(foods1_8, gbc1); - middlePanel1.add(foods1_8); - JLabel note1_8 = new JLabel(Note1_8, SwingConstants.CENTER); - note1_8.setPreferredSize(new Dimension(220, 45)); - note1_8.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - note1_8.setForeground(Color.black);//设置文字的颜色 - note1_8.setOpaque(true); - note1_8.setBackground(new Color(252, 250, 250)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 4; - gbc1.gridy = 8; - gbl1.setConstraints(note1_8, gbc1); - middlePanel1.add(note1_8); +// 创建显示第八个乘客姓名的标签 + JLabel name1_8 = new JLabel(Name1_8, SwingConstants.CENTER); + name1_8.setPreferredSize(new Dimension(220, 45)); // 设置标签尺寸 + name1_8.setOpaque(true); // 设置为不透明 + name1_8.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); // 设置字体 + name1_8.setForeground(Color.black); // 设置文字颜色 + name1_8.setBackground(new Color(252, 250, 250)); // 设置背景颜色(浅灰色) +// 设置网格布局约束条件 + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 0; // 第0列 + gbc1.gridy = 8; // 第8行 + gbl1.setConstraints(name1_8, gbc1); + middlePanel1.add(name1_8); // 添加到中间面板 + +// 创建显示第八个乘客状态的标签 + JLabel state1_8 = new JLabel(State1_8, SwingConstants.CENTER); + state1_8.setPreferredSize(new Dimension(220, 45)); + state1_8.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + state1_8.setForeground(Color.black); + state1_8.setOpaque(true); + state1_8.setBackground(new Color(252, 250, 250)); + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 1; // 第1列 + gbc1.gridy = 8; // 第8行 + gbl1.setConstraints(state1_8, gbc1); + middlePanel1.add(state1_8); + +// 创建显示第八个乘客座位号的标签 + JLabel seats1_8 = new JLabel(Seats1_8, SwingConstants.CENTER); + seats1_8.setPreferredSize(new Dimension(220, 45)); + seats1_8.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + seats1_8.setForeground(Color.black); + seats1_8.setOpaque(true); + seats1_8.setBackground(new Color(252, 250, 250)); + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 2; // 第2列 + gbc1.gridy = 8; // 第8行 + gbl1.setConstraints(seats1_8, gbc1); + middlePanel1.add(seats1_8); + +// 创建显示第八个乘客餐食选择的标签 + JLabel foods1_8 = new JLabel(Foods1_8, SwingConstants.CENTER); + foods1_8.setPreferredSize(new Dimension(220, 45)); + foods1_8.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + foods1_8.setForeground(Color.black); + foods1_8.setOpaque(true); + foods1_8.setBackground(new Color(252, 250, 250)); + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 3; // 第3列 + gbc1.gridy = 8; // 第8行 + gbl1.setConstraints(foods1_8, gbc1); + middlePanel1.add(foods1_8); + +// 创建显示第八个乘客备注信息的标签 + JLabel note1_8 = new JLabel(Note1_8, SwingConstants.CENTER); + note1_8.setPreferredSize(new Dimension(220, 45)); + note1_8.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + note1_8.setForeground(Color.black); + note1_8.setOpaque(true); + note1_8.setBackground(new Color(252, 250, 250)); + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 4; // 第4列 + gbc1.gridy = 8; // 第8行 + gbl1.setConstraints(note1_8, gbc1); + middlePanel1.add(note1_8); + + + // 声明第一页第九个乘客的信息变量 String Name1_9 = ""; - String State1_9 =""; - String Seats1_9 =""; - String Foods1_9 =""; + String State1_9 = ""; + String Seats1_9 = ""; + String Foods1_9 = ""; String Note1_9 = ""; - if(passenger_num>=9) { + +// 如果乘客数量大于等于9,则处理第九个乘客的信息 + if (passenger_num >= 9) { + // 将第九个乘客的信息字符串按空格分割成数组 String[] information1_9 = information.get(8).split("\\s+"); + // 通过乘客订单对象获取乘客姓名 Name1_9 = po.findName(information1_9[0]); + // 获取乘客状态信息(索引为5) State1_9 = information1_9[5]; - if(!information1_9[3].equals("LETTERUNCHOSEN")&&!information1_9[4].equals("NUMBERUNCHOSEN")) { + // 如果座位字母和数字都已选择,则组合成完整座位号 + if (!information1_9[3].equals("LETTERUNCHOSEN") && !information1_9[4].equals("NUMBERUNCHOSEN")) { Seats1_9 = information1_9[3] + information1_9[4]; } - if(!information1_9[2].equals("FOODUNCHOSEN")){ + // 如果已选择餐食,则获取餐食信息 + if (!information1_9[2].equals("FOODUNCHOSEN")) { Foods1_9 = information1_9[2]; } - if(information1_9.length>9) { - LENGTH=information1_9.length; - while(LENGTH>=9) { - Note1_9 = information1_9[LENGTH-2]+" "+Note1_9; - LENGTH=LENGTH-1; + // 如果信息数组长度大于9,说明有备注信息需要处理 + if (information1_9.length > 9) { + LENGTH = information1_9.length; + // 循环处理备注信息,从后往前拼接 + while (LENGTH >= 9) { + Note1_9 = information1_9[LENGTH - 2] + " " + Note1_9; + LENGTH = LENGTH - 1; } - }else{ + } else { + // 如果信息数组长度不大于9,检查是否有备注信息 if (information1_9[7].equals("NOTE")) { - Note1_9 = ""; + Note1_9 = ""; // 没有备注信息 } else { - Note1_9 = information1_9[7]; + Note1_9 = information1_9[7]; // 获取备注信息 } } } - JLabel name1_9 = new JLabel(Name1_9,SwingConstants.CENTER); - name1_9.setPreferredSize(new Dimension(220, 45)); - name1_9.setOpaque(true); - name1_9.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - name1_9.setForeground(Color.black);//设置文字的颜色 - name1_9.setBackground(new Color(232, 232, 232)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 0; - gbc1.gridy = 9; - gbl1.setConstraints(name1_9, gbc1); - middlePanel1.add(name1_9); - JLabel state1_9 = new JLabel(State1_9, SwingConstants.CENTER); - state1_9.setPreferredSize(new Dimension(220, 45)); - state1_9.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - state1_9.setForeground(Color.black);//设置文字的颜色 - state1_9.setOpaque(true); - state1_9.setBackground(new Color(232, 232, 232)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 1; - gbc1.gridy = 9; - gbl1.setConstraints(state1_9, gbc1); - middlePanel1.add(state1_9); - JLabel seats1_9 = new JLabel(Seats1_9, SwingConstants.CENTER); - seats1_9.setPreferredSize(new Dimension(220, 45)); - seats1_9.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - seats1_9.setForeground(Color.black);//设置文字的颜色 - seats1_9.setOpaque(true); - seats1_9.setBackground(new Color(232, 232, 232)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 2; - gbc1.gridy = 9; - gbl1.setConstraints(seats1_9, gbc1); - middlePanel1.add(seats1_9); - JLabel foods1_9 = new JLabel(Foods1_9, SwingConstants.CENTER); - foods1_9.setPreferredSize(new Dimension(220, 45)); - foods1_9.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - foods1_9.setForeground(Color.black);//设置文字的颜色 - foods1_9.setOpaque(true); - foods1_9.setBackground(new Color(232, 232, 232)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 3; - gbc1.gridy = 9; - gbl1.setConstraints(foods1_9, gbc1); - middlePanel1.add(foods1_9); - JLabel note1_9 = new JLabel(Note1_9, SwingConstants.CENTER); - note1_9.setPreferredSize(new Dimension(220, 45)); - note1_9.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - note1_9.setForeground(Color.black);//设置文字的颜色 - note1_9.setOpaque(true); - note1_9.setBackground(new Color(232, 232, 232)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 4; - gbc1.gridy = 9; - gbl1.setConstraints(note1_9, gbc1); - middlePanel1.add(note1_9); +// 创建显示第九个乘客姓名的标签 + JLabel name1_9 = new JLabel(Name1_9, SwingConstants.CENTER); + name1_9.setPreferredSize(new Dimension(220, 45)); // 设置标签尺寸 + name1_9.setOpaque(true); // 设置为不透明 + name1_9.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); // 设置字体 + name1_9.setForeground(Color.black); // 设置文字颜色 + name1_9.setBackground(new Color(232, 232, 232)); // 设置背景颜色(深灰色) +// 设置网格布局约束条件 + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 0; // 第0列 + gbc1.gridy = 9; // 第9行 + gbl1.setConstraints(name1_9, gbc1); + middlePanel1.add(name1_9); // 添加到中间面板 + +// 创建显示第九个乘客状态的标签 + JLabel state1_9 = new JLabel(State1_9, SwingConstants.CENTER); + state1_9.setPreferredSize(new Dimension(220, 45)); + state1_9.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + state1_9.setForeground(Color.black); + state1_9.setOpaque(true); + state1_9.setBackground(new Color(232, 232, 232)); + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 1; // 第1列 + gbc1.gridy = 9; // 第9行 + gbl1.setConstraints(state1_9, gbc1); + middlePanel1.add(state1_9); + +// 创建显示第九个乘客座位号的标签 + JLabel seats1_9 = new JLabel(Seats1_9, SwingConstants.CENTER); + seats1_9.setPreferredSize(new Dimension(220, 45)); + seats1_9.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + seats1_9.setForeground(Color.black); + seats1_9.setOpaque(true); + seats1_9.setBackground(new Color(232, 232, 232)); + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 2; // 第2列 + gbc1.gridy = 9; // 第9行 + gbl1.setConstraints(seats1_9, gbc1); + middlePanel1.add(seats1_9); + +// 创建显示第九个乘客餐食选择的标签 + JLabel foods1_9 = new JLabel(Foods1_9, SwingConstants.CENTER); + foods1_9.setPreferredSize(new Dimension(220, 45)); + foods1_9.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + foods1_9.setForeground(Color.black); + foods1_9.setOpaque(true); + foods1_9.setBackground(new Color(232, 232, 232)); + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 3; // 第3列 + gbc1.gridy = 9; // 第9行 + gbl1.setConstraints(foods1_9, gbc1); + middlePanel1.add(foods1_9); + +// 创建显示第九个乘客备注信息的标签 + JLabel note1_9 = new JLabel(Note1_9, SwingConstants.CENTER); + note1_9.setPreferredSize(new Dimension(220, 45)); + note1_9.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + note1_9.setForeground(Color.black); + note1_9.setOpaque(true); + note1_9.setBackground(new Color(232, 232, 232)); + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 4; // 第4列 + gbc1.gridy = 9; // 第9行 + gbl1.setConstraints(note1_9, gbc1); + middlePanel1.add(note1_9); + +// 声明第一页第十个乘客的信息变量 String Name1_10 = ""; - String State1_10 =""; - String Seats1_10 =""; - String Foods1_10 =""; + String State1_10 = ""; + String Seats1_10 = ""; + String Foods1_10 = ""; String Note1_10 = ""; - if(passenger_num>=10) { + +// 如果乘客数量大于等于10,则处理第十个乘客的信息 + if (passenger_num >= 10) { + // 将第十个乘客的信息字符串按空格分割成数组 String[] information1_10 = information.get(9).split("\\s+"); + // 通过乘客订单对象获取乘客姓名 Name1_10 = po.findName(information1_10[0]); + // 获取乘客状态信息(索引为5) State1_10 = information1_10[5]; - if(!information1_10[3].equals("LETTERUNCHOSEN")&&!information1_10[4].equals("NUMBERUNCHOSEN")) { + // 如果座位字母和数字都已选择,则组合成完整座位号 + if (!information1_10[3].equals("LETTERUNCHOSEN") && !information1_10[4].equals("NUMBERUNCHOSEN")) { Seats1_10 = information1_10[3] + information1_10[4]; } - if(!information1_10[2].equals("FOODUNCHOSEN")){ + // 如果已选择餐食,则获取餐食信息 + if (!information1_10[2].equals("FOODUNCHOSEN")) { Foods1_10 = information1_10[2]; } - if(information1_10.length>9) { - LENGTH=information1_10.length; - while(LENGTH>=9) { - Note1_10 = information1_10[LENGTH-2]+" "+Note1_10; - LENGTH=LENGTH-1; + // 如果信息数组长度大于9,说明有备注信息需要处理 + if (information1_10.length > 9) { + LENGTH = information1_10.length; + // 循环处理备注信息,从后往前拼接 + while (LENGTH >= 9) { + Note1_10 = information1_10[LENGTH - 2] + " " + Note1_10; + LENGTH = LENGTH - 1; } - }else{ + } else { + // 如果信息数组长度不大于9,检查是否有备注信息 if (information1_10[7].equals("NOTE")) { - Note1_10 = ""; + Note1_10 = ""; // 没有备注信息 } else { - Note1_10 = information1_10[7]; + Note1_10 = information1_10[7]; // 获取备注信息 } } } - JLabel name1_10 = new JLabel(Name1_10,SwingConstants.CENTER); - name1_10.setPreferredSize(new Dimension(220, 45)); - name1_10.setOpaque(true); - name1_10.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - name1_10.setForeground(Color.black);//设置文字的颜色 - name1_10.setBackground(new Color(252, 250, 250)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 0; - gbc1.gridy = 10; - gbl1.setConstraints(name1_10, gbc1); - middlePanel1.add(name1_10); - JLabel state1_10 = new JLabel(State1_10, SwingConstants.CENTER); - state1_10.setPreferredSize(new Dimension(220, 45)); - state1_10.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - state1_10.setForeground(Color.black);//设置文字的颜色 - state1_10.setOpaque(true); - state1_10.setBackground(new Color(252, 250, 250)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 1; - gbc1.gridy = 10; - gbl1.setConstraints(state1_10, gbc1); - middlePanel1.add(state1_10); - JLabel seats1_10 = new JLabel(Seats1_10, SwingConstants.CENTER); - seats1_10.setPreferredSize(new Dimension(220, 45)); - seats1_10.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - seats1_10.setForeground(Color.black);//设置文字的颜色 - seats1_10.setOpaque(true); - seats1_10.setBackground(new Color(252, 250, 250)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 2; - gbc1.gridy = 10; - gbl1.setConstraints(seats1_10, gbc1); - middlePanel1.add(seats1_10); - JLabel foods1_10 = new JLabel(Foods1_10, SwingConstants.CENTER); - foods1_10.setPreferredSize(new Dimension(220, 45)); - foods1_10.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - foods1_10.setForeground(Color.black);//设置文字的颜色 - foods1_10.setOpaque(true); - foods1_10.setBackground(new Color(252, 250, 250)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 3; - gbc1.gridy = 10; - gbl1.setConstraints(foods1_10, gbc1); - middlePanel1.add(foods1_10); - JLabel note1_10 = new JLabel(Note1_10, SwingConstants.CENTER); - note1_10.setPreferredSize(new Dimension(220, 45)); - note1_10.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - note1_10.setForeground(Color.black);//设置文字的颜色 - note1_10.setOpaque(true); - note1_10.setBackground(new Color(252, 250, 250)); - gbc1.weightx = 0.2; // 指定组件的分配区域 - gbc1.weighty = 0.09; - gbc1.gridwidth = 1; - gbc1.gridheight = 1; - gbc1.gridx = 4; - gbc1.gridy = 10; - gbl1.setConstraints(note1_10, gbc1); - middlePanel1.add(note1_10); - - p1.add(middlePanel1); - - panel.add(p1,"1"); +// 创建显示第十个乘客姓名的标签 + JLabel name1_10 = new JLabel(Name1_10, SwingConstants.CENTER); + name1_10.setPreferredSize(new Dimension(220, 45)); // 设置标签尺寸 + name1_10.setOpaque(true); // 设置为不透明 + name1_10.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); // 设置字体 + name1_10.setForeground(Color.black); // 设置文字颜色 + name1_10.setBackground(new Color(252, 250, 250)); // 设置背景颜色(浅灰色) +// 设置网格布局约束条件 + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 0; // 第0列 + gbc1.gridy = 10; // 第10行 + gbl1.setConstraints(name1_10, gbc1); + middlePanel1.add(name1_10); // 添加到中间面板 + +// 创建显示第十个乘客状态的标签 + JLabel state1_10 = new JLabel(State1_10, SwingConstants.CENTER); + state1_10.setPreferredSize(new Dimension(220, 45)); + state1_10.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + state1_10.setForeground(Color.black); + state1_10.setOpaque(true); + state1_10.setBackground(new Color(252, 250, 250)); + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 1; // 第1列 + gbc1.gridy = 10; // 第10行 + gbl1.setConstraints(state1_10, gbc1); + middlePanel1.add(state1_10); + +// 创建显示第十个乘客座位号的标签 + JLabel seats1_10 = new JLabel(Seats1_10, SwingConstants.CENTER); + seats1_10.setPreferredSize(new Dimension(220, 45)); + seats1_10.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + seats1_10.setForeground(Color.black); + seats1_10.setOpaque(true); + seats1_10.setBackground(new Color(252, 250, 250)); + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 2; // 第2列 + gbc1.gridy = 10; // 第10行 + gbl1.setConstraints(seats1_10, gbc1); + middlePanel1.add(seats1_10); + +// 创建显示第十个乘客餐食选择的标签 + JLabel foods1_10 = new JLabel(Foods1_10, SwingConstants.CENTER); + foods1_10.setPreferredSize(new Dimension(220, 45)); + foods1_10.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + foods1_10.setForeground(Color.black); + foods1_10.setOpaque(true); + foods1_10.setBackground(new Color(252, 250, 250)); + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 3; // 第3列 + gbc1.gridy = 10; // 第10行 + gbl1.setConstraints(foods1_10, gbc1); + middlePanel1.add(foods1_10); + +// 创建显示第十个乘客备注信息的标签 + JLabel note1_10 = new JLabel(Note1_10, SwingConstants.CENTER); + note1_10.setPreferredSize(new Dimension(220, 45)); + note1_10.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + note1_10.setForeground(Color.black); + note1_10.setOpaque(true); + note1_10.setBackground(new Color(252, 250, 250)); + gbc1.weightx = 0.2; // 指定组件的分配区域 + gbc1.weighty = 0.09; + gbc1.gridwidth = 1; + gbc1.gridheight = 1; + gbc1.gridx = 4; // 第4列 + gbc1.gridy = 10; // 第10行 + gbl1.setConstraints(note1_10, gbc1); + middlePanel1.add(note1_10); + +// 将中间面板添加到第一页面板中 + p1.add(middlePanel1); + +// 将第一页面板添加到主面板中,标识为"1" + panel.add(p1, "1"); + +// 创建第二页乘客信息面板 JPanel p2 = new JPanel(); - p2.setBackground(new Color(72,46,115)); - p2.setPreferredSize(new Dimension(1200,680)); - p2.setLayout(null); + p2.setBackground(new Color(72, 46, 115)); // 设置背景颜色 + p2.setPreferredSize(new Dimension(1200, 680)); // 设置面板尺寸 + p2.setLayout(null); // 使用绝对布局 + // 创建第二页的航班标题标签,显示航班号 JLabel Head2 = new JLabel(Flight_num); - Head2.setBounds(450,10,300,50); - //外观设计 - Head2.setFont(new Font(Font.DIALOG,Font.BOLD,29));//设置文字字体 - Head2.setForeground(Color.white);//设置文字的颜色 - Head2.setOpaque(true); - Head2.setBackground(new Color(96, 62,151)); - Head2.setPreferredSize(new Dimension(300,50)); - Head2.setHorizontalAlignment(JLabel.CENTER); - - p2.add(Head2); - + Head2.setBounds(450, 10, 300, 50); // 设置位置和大小 +// 外观设计 + Head2.setFont(new Font(Font.DIALOG, Font.BOLD, 29)); // 设置字体样式和大小 + Head2.setForeground(Color.white); // 设置文字颜色为白色 + Head2.setOpaque(true); // 设置为不透明 + Head2.setBackground(new Color(96, 62, 151)); // 设置背景颜色 + Head2.setPreferredSize(new Dimension(300, 50)); // 设置首选尺寸 + Head2.setHorizontalAlignment(JLabel.CENTER); // 文字居中对齐 + + p2.add(Head2); // 将标题标签添加到第二页面板中 + +// 创建"上一页"按钮 JButton button_left = new JButton("LAST"); - button_left.setFont(new Font(Font.DIALOG,Font.BOLD,29));//设置文字字体 - button_left.setForeground(Color.white);//设置文字的颜色 - button_left.setBackground(new Color(96, 62,151)); - button_left.setSize(200,50); - button_left.setVisible(false); + button_left.setFont(new Font(Font.DIALOG, Font.BOLD, 29)); // 设置字体样式和大小 + button_left.setForeground(Color.white); // 设置文字颜色为白色 + button_left.setBackground(new Color(96, 62, 151)); // 设置背景颜色 + button_left.setSize(200, 50); // 设置按钮尺寸 + button_left.setVisible(false); // 初始时不可见 JLabel label_left = new JLabel(); - label_left.setBounds(200,10,200,50); - //外观设计 - label_left.setOpaque(true); - label_left.setBackground(new Color(96, 62,151)); - label_left.setHorizontalAlignment(JLabel.CENTER); - label_left.add(button_left); - - p2.add(label_left); + label_left.setBounds(200, 10, 200, 50); // 设置位置和大小 +// 外观设计 + label_left.setOpaque(true); // 设置为不透明 + label_left.setBackground(new Color(96, 62, 151)); // 设置背景颜色 + label_left.setHorizontalAlignment(JLabel.CENTER); // 居中对齐 + label_left.add(button_left); // 将按钮添加到标签中 + p2.add(label_left); // 将标签添加到第二页面板中 +// 创建第二页中间信息显示面板 JPanel middlePanel2 = new JPanel(); - middlePanel2.setBounds(50,80,1100,500); - + middlePanel2.setBounds(50, 80, 1100, 500); // 设置位置和大小 +// 使用网格包布局管理器 GridBagLayout gbl2 = new GridBagLayout(); GridBagConstraints gbc2 = new GridBagConstraints(); middlePanel2.setLayout(gbl2); - gbc2.fill=GridBagConstraints.BOTH; - - - JLabel information21 = new JLabel("Name",SwingConstants.CENTER); - information21.setPreferredSize(new Dimension(220, 50)); - information21.setOpaque(true); - information21.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - information21.setForeground(Color.black);//设置文字的颜色 - information21.setBackground(new Color(252, 250, 250)); + gbc2.fill = GridBagConstraints.BOTH; // 组件填充方式 + +// 创建第二页表头标签 - 姓名列 + JLabel information21 = new JLabel("Name", SwingConstants.CENTER); + information21.setPreferredSize(new Dimension(220, 50)); // 设置首选尺寸 + information21.setOpaque(true); // 设置为不透明 + information21.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); // 设置字体 + information21.setForeground(Color.black); // 设置文字颜色 + information21.setBackground(new Color(252, 250, 250)); // 设置背景颜色 gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.1; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 0; + gbc2.gridx = 0; // 设置网格位置 gbc2.gridy = 0; gbl2.setConstraints(information21, gbc2); middlePanel2.add(information21); + +// 创建第二页表头标签 - 状态列 JLabel information22 = new JLabel("State", SwingConstants.CENTER); information22.setPreferredSize(new Dimension(220, 50)); - information22.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - information22.setForeground(Color.black);//设置文字的颜色 + information22.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + information22.setForeground(Color.black); information22.setOpaque(true); information22.setBackground(new Color(252, 250, 250)); gbc2.weightx = 0.2; // 指定组件的分配区域 @@ -1231,10 +1477,12 @@ public class Admin_Information extends JPanel { gbc2.gridy = 0; gbl2.setConstraints(information22, gbc2); middlePanel2.add(information22); + +// 创建第二页表头标签 - 座位列 JLabel information23 = new JLabel("Seats", SwingConstants.CENTER); information23.setPreferredSize(new Dimension(220, 50)); - information23.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - information23.setForeground(Color.black);//设置文字的颜色 + information23.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + information23.setForeground(Color.black); information23.setOpaque(true); information23.setBackground(new Color(252, 250, 250)); gbc2.weightx = 0.2; // 指定组件的分配区域 @@ -1245,10 +1493,12 @@ public class Admin_Information extends JPanel { gbc2.gridy = 0; gbl2.setConstraints(information23, gbc2); middlePanel2.add(information23); + +// 创建第二页表头标签 - 餐食列 JLabel information24 = new JLabel("Foods", SwingConstants.CENTER); information24.setPreferredSize(new Dimension(220, 50)); - information24.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - information24.setForeground(Color.black);//设置文字的颜色 + information24.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + information24.setForeground(Color.black); information24.setOpaque(true); information24.setBackground(new Color(252, 250, 250)); gbc2.weightx = 0.2; // 指定组件的分配区域 @@ -1259,10 +1509,12 @@ public class Admin_Information extends JPanel { gbc2.gridy = 0; gbl2.setConstraints(information24, gbc2); middlePanel2.add(information24); + +// 创建第二页表头标签 - 备注列 JLabel information25 = new JLabel("Note", SwingConstants.CENTER); information25.setPreferredSize(new Dimension(220, 50)); - information25.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - information25.setForeground(Color.black);//设置文字的颜色 + information25.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + information25.setForeground(Color.black); information25.setOpaque(true); information25.setBackground(new Color(252, 250, 250)); gbc2.weightx = 0.2; // 指定组件的分配区域 @@ -1274,1021 +1526,1249 @@ public class Admin_Information extends JPanel { gbl2.setConstraints(information25, gbc2); middlePanel2.add(information25); - - +// 声明第二页第一个乘客的信息变量 String Name2_1 = ""; - String State2_1 =""; - String Seats2_1 =""; - String Foods2_1 =""; + String State2_1 = ""; + String Seats2_1 = ""; + String Foods2_1 = ""; String Note2_1 = ""; - if(passenger_num>=11) { + +// 如果乘客数量大于等于11,则处理第十一个乘客的信息 + if (passenger_num >= 11) { + // 将第十一个乘客的信息字符串按空格分割成数组 String[] information2_1 = information.get(10).split("\\s+"); + // 通过乘客订单对象获取乘客姓名 Name2_1 = po.findName(information2_1[0]); + // 获取乘客状态信息(索引为5) State2_1 = information2_1[5]; - if(!information2_1[3].equals("LETTERUNCHOSEN")&&!information2_1[4].equals("NUMBERUNCHOSEN")) { + // 如果座位字母和数字都已选择,则组合成完整座位号 + if (!information2_1[3].equals("LETTERUNCHOSEN") && !information2_1[4].equals("NUMBERUNCHOSEN")) { Seats2_1 = information2_1[3] + information2_1[4]; } - if(!information2_1[2].equals("FOODUNCHOSEN")){ + // 如果已选择餐食,则获取餐食信息 + if (!information2_1[2].equals("FOODUNCHOSEN")) { Foods2_1 = information2_1[2]; } - if(information2_1.length>9) { - LENGTH=information2_1.length; - while(LENGTH>=9) { - Note2_1 = information2_1[LENGTH-2]+" "+Note2_1; - LENGTH=LENGTH-1; + // 如果信息数组长度大于9,说明有备注信息需要处理 + if (information2_1.length > 9) { + LENGTH = information2_1.length; + // 循环处理备注信息,从后往前拼接 + while (LENGTH >= 9) { + Note2_1 = information2_1[LENGTH - 2] + " " + Note2_1; + LENGTH = LENGTH - 1; } - }else{ + } else { + // 如果信息数组长度不大于9,检查是否有备注信息 if (information2_1[7].equals("NOTE")) { - Note2_1 = ""; + Note2_1 = ""; // 没有备注信息 } else { - Note2_1 = information2_1[7]; + Note2_1 = information2_1[7]; // 获取备注信息 } } } - JLabel name2_1 = new JLabel(Name2_1,SwingConstants.CENTER); - name2_1.setPreferredSize(new Dimension(220, 45)); - name2_1.setOpaque(true); - name2_1.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - name2_1.setForeground(Color.black);//设置文字的颜色 - name2_1.setBackground(new Color(232, 232, 232)); + +// 创建显示第十一个乘客姓名的标签 + JLabel name2_1 = new JLabel(Name2_1, SwingConstants.CENTER); + name2_1.setPreferredSize(new Dimension(220, 45)); // 设置标签尺寸 + name2_1.setOpaque(true); // 设置为不透明 + name2_1.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); // 设置字体 + name2_1.setForeground(Color.black); // 设置文字颜色 + name2_1.setBackground(new Color(232, 232, 232)); // 设置背景颜色(深灰色) +// 设置网格布局约束条件 gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 0; - gbc2.gridy = 1; + gbc2.gridx = 0; // 第0列 + gbc2.gridy = 1; // 第1行(表头下方第一行) gbl2.setConstraints(name2_1, gbc2); - middlePanel2.add(name2_1); + middlePanel2.add(name2_1); // 添加到中间面板 + +// 创建显示第十一个乘客状态的标签 JLabel state2_1 = new JLabel(State2_1, SwingConstants.CENTER); state2_1.setPreferredSize(new Dimension(220, 45)); - state2_1.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - state2_1.setForeground(Color.black);//设置文字的颜色 + state2_1.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + state2_1.setForeground(Color.black); state2_1.setOpaque(true); state2_1.setBackground(new Color(232, 232, 232)); gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 1; - gbc2.gridy = 1; + gbc2.gridx = 1; // 第1列 + gbc2.gridy = 1; // 第1行 gbl2.setConstraints(state2_1, gbc2); middlePanel2.add(state2_1); + +// 创建显示第十一个乘客座位号的标签 JLabel seats2_1 = new JLabel(Seats2_1, SwingConstants.CENTER); seats2_1.setPreferredSize(new Dimension(220, 45)); - seats2_1.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - seats2_1.setForeground(Color.black);//设置文字的颜色 + seats2_1.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + seats2_1.setForeground(Color.black); seats2_1.setOpaque(true); seats2_1.setBackground(new Color(232, 232, 232)); gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 2; - gbc2.gridy = 1; + gbc2.gridx = 2; // 第2列 + gbc2.gridy = 1; // 第1行 gbl2.setConstraints(seats2_1, gbc2); middlePanel2.add(seats2_1); + +// 创建显示第十一个乘客餐食选择的标签 JLabel foods2_1 = new JLabel(Foods2_1, SwingConstants.CENTER); foods2_1.setPreferredSize(new Dimension(220, 45)); - foods2_1.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - foods2_1.setForeground(Color.black);//设置文字的颜色 + foods2_1.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + foods2_1.setForeground(Color.black); foods2_1.setOpaque(true); foods2_1.setBackground(new Color(232, 232, 232)); gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 3; - gbc2.gridy = 1; + gbc2.gridx = 3; // 第3列 + gbc2.gridy = 1; // 第1行 gbl2.setConstraints(foods2_1, gbc2); middlePanel2.add(foods2_1); + +// 创建显示第十一个乘客备注信息的标签 JLabel note2_1 = new JLabel(Note2_1, SwingConstants.CENTER); note2_1.setPreferredSize(new Dimension(220, 45)); - note2_1.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - note2_1.setForeground(Color.black);//设置文字的颜色 + note2_1.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + note2_1.setForeground(Color.black); note2_1.setOpaque(true); note2_1.setBackground(new Color(232, 232, 232)); gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 4; - gbc2.gridy = 1; + gbc2.gridx = 4; // 第4列 + gbc2.gridy = 1; // 第1行 gbl2.setConstraints(note2_1, gbc2); middlePanel2.add(note2_1); + + // 声明第二个页面第二个乘客的信息变量 String Name2_2 = ""; - String State2_2 =""; - String Seats2_2 =""; - String Foods2_2 =""; + String State2_2 = ""; + String Seats2_2 = ""; + String Foods2_2 = ""; String Note2_2 = ""; - if(passenger_num>=12) { + +// 如果乘客数量大于等于12,则处理第十二个乘客的信息 + if (passenger_num >= 12) { + // 将第十二个乘客的信息字符串按空格分割成数组 String[] information2_2 = information.get(11).split("\\s+"); + // 通过乘客订单对象获取乘客姓名 Name2_2 = po.findName(information2_2[0]); + // 获取乘客状态信息(索引为5) State2_2 = information2_2[5]; - if(!information2_2[3].equals("LETTERUNCHOSEN")&&!information2_2[4].equals("NUMBERUNCHOSEN")) { + // 如果座位字母和数字都已选择,则组合成完整座位号 + if (!information2_2[3].equals("LETTERUNCHOSEN") && !information2_2[4].equals("NUMBERUNCHOSEN")) { Seats2_2 = information2_2[3] + information2_2[4]; } - if(!information2_2[2].equals("FOODUNCHOSEN")){ + // 如果已选择餐食,则获取餐食信息 + if (!information2_2[2].equals("FOODUNCHOSEN")) { Foods2_2 = information2_2[2]; } - if(information2_2.length>9) { - LENGTH=information2_2.length; - while(LENGTH>=9) { - Note2_2 = information2_2[LENGTH-2]+" "+Note2_2; - LENGTH=LENGTH-1; + // 如果信息数组长度大于9,说明有备注信息需要处理 + if (information2_2.length > 9) { + LENGTH = information2_2.length; + // 循环处理备注信息,从后往前拼接 + while (LENGTH >= 9) { + Note2_2 = information2_2[LENGTH - 2] + " " + Note2_2; + LENGTH = LENGTH - 1; } - }else{ + } else { + // 如果信息数组长度不大于9,检查是否有备注信息 if (information2_2[7].equals("NOTE")) { - Note2_2 = ""; + Note2_2 = ""; // 没有备注信息 } else { - Note2_2 = information2_2[7]; + Note2_2 = information2_2[7]; // 获取备注信息 } } } - JLabel name2_2 = new JLabel(Name2_2,SwingConstants.CENTER); - name2_2.setPreferredSize(new Dimension(220, 45)); - name2_2.setOpaque(true); - name2_2.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - name2_2.setForeground(Color.black);//设置文字的颜色 - name2_2.setBackground(new Color(252, 250, 250)); + +// 创建显示第十二个乘客姓名的标签 + JLabel name2_2 = new JLabel(Name2_2, SwingConstants.CENTER); + name2_2.setPreferredSize(new Dimension(220, 45)); // 设置标签尺寸 + name2_2.setOpaque(true); // 设置为不透明 + name2_2.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); // 设置字体 + name2_2.setForeground(Color.black); // 设置文字颜色 + name2_2.setBackground(new Color(252, 250, 250)); // 设置背景颜色(浅灰色) +// 设置网格布局约束条件 gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 0; - gbc2.gridy = 2; + gbc2.gridx = 0; // 第0列 + gbc2.gridy = 2; // 第2行 gbl2.setConstraints(name2_2, gbc2); - middlePanel2.add(name2_2); + middlePanel2.add(name2_2); // 添加到中间面板 + +// 创建显示第十二个乘客状态的标签 JLabel state2_2 = new JLabel(State2_2, SwingConstants.CENTER); state2_2.setPreferredSize(new Dimension(220, 45)); - state2_2.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - state2_2.setForeground(Color.black);//设置文字的颜色 + state2_2.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + state2_2.setForeground(Color.black); state2_2.setOpaque(true); state2_2.setBackground(new Color(252, 250, 250)); gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 1; - gbc2.gridy = 2; + gbc2.gridx = 1; // 第1列 + gbc2.gridy = 2; // 第2行 gbl2.setConstraints(state2_2, gbc2); middlePanel2.add(state2_2); + +// 创建显示第十二个乘客座位号的标签 JLabel seats2_2 = new JLabel(Seats2_2, SwingConstants.CENTER); seats2_2.setPreferredSize(new Dimension(220, 45)); - seats2_2.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - seats2_2.setForeground(Color.black);//设置文字的颜色 + seats2_2.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + seats2_2.setForeground(Color.black); seats2_2.setOpaque(true); seats2_2.setBackground(new Color(252, 250, 250)); gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 2; - gbc2.gridy = 2; + gbc2.gridx = 2; // 第2列 + gbc2.gridy = 2; // 第2行 gbl2.setConstraints(seats2_2, gbc2); middlePanel2.add(seats2_2); + +// 创建显示第十二个乘客餐食选择的标签 JLabel foods2_2 = new JLabel(Foods2_2, SwingConstants.CENTER); foods2_2.setPreferredSize(new Dimension(220, 45)); - foods2_2.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - foods2_2.setForeground(Color.black);//设置文字的颜色 + foods2_2.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + foods2_2.setForeground(Color.black); foods2_2.setOpaque(true); foods2_2.setBackground(new Color(252, 250, 250)); gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 3; - gbc2.gridy = 2; + gbc2.gridx = 3; // 第3列 + gbc2.gridy = 2; // 第2行 gbl2.setConstraints(foods2_2, gbc2); middlePanel2.add(foods2_2); + +// 创建显示第十二个乘客备注信息的标签 JLabel note2_2 = new JLabel(Note2_2, SwingConstants.CENTER); note2_2.setPreferredSize(new Dimension(220, 45)); - note2_2.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - note2_2.setForeground(Color.black);//设置文字的颜色 + note2_2.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + note2_2.setForeground(Color.black); note2_2.setOpaque(true); note2_2.setBackground(new Color(252, 250, 250)); gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 4; - gbc2.gridy = 2; + gbc2.gridx = 4; // 第4列 + gbc2.gridy = 2; // 第2行 gbl2.setConstraints(note2_2, gbc2); middlePanel2.add(note2_2); +// 声明第二个页面第三个乘客的信息变量 String Name2_3 = ""; - String State2_3 =""; - String Seats2_3 =""; - String Foods2_3 =""; + String State2_3 = ""; + String Seats2_3 = ""; + String Foods2_3 = ""; String Note2_3 = ""; - if(passenger_num>=13) { + +// 如果乘客数量大于等于13,则处理第十三个乘客的信息 + if (passenger_num >= 13) { + // 将第十三个乘客的信息字符串按空格分割成数组 String[] information2_3 = information.get(12).split("\\s+"); + // 通过乘客订单对象获取乘客姓名 Name2_3 = po.findName(information2_3[0]); + // 获取乘客状态信息(索引为5) State2_3 = information2_3[5]; - if(!information2_3[3].equals("LETTERUNCHOSEN")&&!information2_3[4].equals("NUMBERUNCHOSEN")) { + // 如果座位字母和数字都已选择,则组合成完整座位号 + if (!information2_3[3].equals("LETTERUNCHOSEN") && !information2_3[4].equals("NUMBERUNCHOSEN")) { Seats2_3 = information2_3[3] + information2_3[4]; } - if(!information2_3[2].equals("FOODUNCHOSEN")){ + // 如果已选择餐食,则获取餐食信息 + if (!information2_3[2].equals("FOODUNCHOSEN")) { Foods2_3 = information2_3[2]; } - if(information2_3.length>9) { - LENGTH=information2_3.length; - while(LENGTH>=9) { - Note2_3 = information2_3[LENGTH-2]+" "+Note2_3; - LENGTH=LENGTH-1; + // 如果信息数组长度大于9,说明有备注信息需要处理 + if (information2_3.length > 9) { + LENGTH = information2_3.length; + // 循环处理备注信息,从后往前拼接 + while (LENGTH >= 9) { + Note2_3 = information2_3[LENGTH - 2] + " " + Note2_3; + LENGTH = LENGTH - 1; } - }else{ + } else { + // 如果信息数组长度不大于9,检查是否有备注信息 if (information2_3[7].equals("NOTE")) { - Note2_3 = ""; + Note2_3 = ""; // 没有备注信息 } else { - Note2_3 = information2_3[7]; + Note2_3 = information2_3[7]; // 获取备注信息 } } } - JLabel name2_3 = new JLabel(Name2_3,SwingConstants.CENTER); - name2_3.setPreferredSize(new Dimension(220, 45)); - name2_3.setOpaque(true); - name2_3.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - name2_3.setForeground(Color.black);//设置文字的颜色 - name2_3.setBackground(new Color(232, 232, 232)); + +// 创建显示第十三个乘客姓名的标签 + JLabel name2_3 = new JLabel(Name2_3, SwingConstants.CENTER); + name2_3.setPreferredSize(new Dimension(220, 45)); // 设置标签尺寸 + name2_3.setOpaque(true); // 设置为不透明 + name2_3.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); // 设置字体 + name2_3.setForeground(Color.black); // 设置文字颜色 + name2_3.setBackground(new Color(232, 232, 232)); // 设置背景颜色(深灰色) +// 设置网格布局约束条件 gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 0; - gbc2.gridy = 3; + gbc2.gridx = 0; // 第0列 + gbc2.gridy = 3; // 第3行 gbl2.setConstraints(name2_3, gbc2); - middlePanel2.add(name2_3); + middlePanel2.add(name2_3); // 添加到中间面板 + +// 创建显示第十三个乘客状态的标签 JLabel state2_3 = new JLabel(State2_3, SwingConstants.CENTER); state2_3.setPreferredSize(new Dimension(220, 45)); - state2_3.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - state2_3.setForeground(Color.black);//设置文字的颜色 + state2_3.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + state2_3.setForeground(Color.black); state2_3.setOpaque(true); state2_3.setBackground(new Color(232, 232, 232)); gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 1; - gbc2.gridy = 3; + gbc2.gridx = 1; // 第1列 + gbc2.gridy = 3; // 第3行 gbl2.setConstraints(state2_3, gbc2); middlePanel2.add(state2_3); + +// 创建显示第十三个乘客座位号的标签 JLabel seats2_3 = new JLabel(Seats2_3, SwingConstants.CENTER); seats2_3.setPreferredSize(new Dimension(220, 45)); - seats2_3.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - seats2_3.setForeground(Color.black);//设置文字的颜色 + seats2_3.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + seats2_3.setForeground(Color.black); seats2_3.setOpaque(true); seats2_3.setBackground(new Color(232, 232, 232)); gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 2; - gbc2.gridy = 3; + gbc2.gridx = 2; // 第2列 + gbc2.gridy = 3; // 第3行 gbl2.setConstraints(seats2_3, gbc2); middlePanel2.add(seats2_3); + +// 创建显示第十三个乘客餐食选择的标签 JLabel foods2_3 = new JLabel(Foods2_3, SwingConstants.CENTER); foods2_3.setPreferredSize(new Dimension(220, 45)); - foods2_3.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - foods2_3.setForeground(Color.black);//设置文字的颜色 + foods2_3.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + foods2_3.setForeground(Color.black); foods2_3.setOpaque(true); foods2_3.setBackground(new Color(232, 232, 232)); gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 3; - gbc2.gridy = 3; + gbc2.gridx = 3; // 第3列 + gbc2.gridy = 3; // 第3行 gbl2.setConstraints(foods2_3, gbc2); middlePanel2.add(foods2_3); + +// 创建显示第十三个乘客备注信息的标签 JLabel note2_3 = new JLabel(Note2_3, SwingConstants.CENTER); note2_3.setPreferredSize(new Dimension(220, 45)); - note2_3.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - note2_3.setForeground(Color.black);//设置文字的颜色 + note2_3.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + note2_3.setForeground(Color.black); note2_3.setOpaque(true); note2_3.setBackground(new Color(232, 232, 232)); gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 4; - gbc2.gridy = 3; + gbc2.gridx = 4; // 第4列 + gbc2.gridy = 3; // 第3行 gbl2.setConstraints(note2_3, gbc2); middlePanel2.add(note2_3); +// 声明第二个页面第四个乘客的信息变量 String Name2_4 = ""; - String State2_4 =""; - String Seats2_4 =""; - String Foods2_4 =""; + String State2_4 = ""; + String Seats2_4 = ""; + String Foods2_4 = ""; String Note2_4 = ""; - if(passenger_num>=14) { + +// 如果乘客数量大于等于14,则处理第十四个乘客的信息 + if (passenger_num >= 14) { + // 将第十四个乘客的信息字符串按空格分割成数组 String[] information2_4 = information.get(13).split("\\s+"); + // 通过乘客订单对象获取乘客姓名 Name2_4 = po.findName(information2_4[0]); + // 获取乘客状态信息(索引为5) State2_4 = information2_4[5]; - if(!information2_4[3].equals("LETTERUNCHOSEN")&&!information2_4[4].equals("NUMBERUNCHOSEN")) { + // 如果座位字母和数字都已选择,则组合成完整座位号 + if (!information2_4[3].equals("LETTERUNCHOSEN") && !information2_4[4].equals("NUMBERUNCHOSEN")) { Seats2_4 = information2_4[3] + information2_4[4]; } - if(!information2_4[2].equals("FOODUNCHOSEN")){ + // 如果已选择餐食,则获取餐食信息 + if (!information2_4[2].equals("FOODUNCHOSEN")) { Foods2_4 = information2_4[2]; } - if(information2_4.length>9) { - LENGTH=information2_4.length; - while(LENGTH>=9) { - Note2_4 = information2_4[LENGTH-2]+" "+Note2_4; - LENGTH=LENGTH-1; + // 如果信息数组长度大于9,说明有备注信息需要处理 + if (information2_4.length > 9) { + LENGTH = information2_4.length; + // 循环处理备注信息,从后往前拼接 + while (LENGTH >= 9) { + Note2_4 = information2_4[LENGTH - 2] + " " + Note2_4; + LENGTH = LENGTH - 1; } - }else{ + } else { + // 如果信息数组长度不大于9,检查是否有备注信息 if (information2_4[7].equals("NOTE")) { - Note2_4 = ""; + Note2_4 = ""; // 没有备注信息 } else { - Note2_4 = information2_4[7]; + Note2_4 = information2_4[7]; // 获取备注信息 } } } - JLabel name2_4 = new JLabel(Name2_4,SwingConstants.CENTER); - name2_4.setPreferredSize(new Dimension(220, 45)); - name2_4.setOpaque(true); - name2_4.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - name2_4.setForeground(Color.black);//设置文字的颜色 - name2_4.setBackground(new Color(252, 250, 250)); + +// 创建显示第十四个乘客姓名的标签 + JLabel name2_4 = new JLabel(Name2_4, SwingConstants.CENTER); + name2_4.setPreferredSize(new Dimension(220, 45)); // 设置标签尺寸 + name2_4.setOpaque(true); // 设置为不透明 + name2_4.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); // 设置字体 + name2_4.setForeground(Color.black); // 设置文字颜色 + name2_4.setBackground(new Color(252, 250, 250)); // 设置背景颜色(浅灰色) +// 设置网格布局约束条件 gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 0; - gbc2.gridy = 4; + gbc2.gridx = 0; // 第0列 + gbc2.gridy = 4; // 第4行 gbl2.setConstraints(name2_4, gbc2); - middlePanel2.add(name2_4); + middlePanel2.add(name2_4); // 添加到中间面板 + +// 创建显示第十四个乘客状态的标签 JLabel state2_4 = new JLabel(State2_4, SwingConstants.CENTER); state2_4.setPreferredSize(new Dimension(220, 45)); - state2_4.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - state2_4.setForeground(Color.black);//设置文字的颜色 + state2_4.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + state2_4.setForeground(Color.black); state2_4.setOpaque(true); state2_4.setBackground(new Color(252, 250, 250)); gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 1; - gbc2.gridy = 4; + gbc2.gridx = 1; // 第1列 + gbc2.gridy = 4; // 第4行 gbl2.setConstraints(state2_4, gbc2); middlePanel2.add(state2_4); + +// 创建显示第十四个乘客座位号的标签 JLabel seats2_4 = new JLabel(Seats2_4, SwingConstants.CENTER); seats2_4.setPreferredSize(new Dimension(220, 45)); - seats2_4.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - seats2_4.setForeground(Color.black);//设置文字的颜色 + seats2_4.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + seats2_4.setForeground(Color.black); seats2_4.setOpaque(true); seats2_4.setBackground(new Color(252, 250, 250)); gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 2; - gbc2.gridy = 4; + gbc2.gridx = 2; // 第2列 + gbc2.gridy = 4; // 第4行 gbl2.setConstraints(seats2_4, gbc2); middlePanel2.add(seats2_4); + +// 创建显示第十四个乘客餐食选择的标签 JLabel foods2_4 = new JLabel(Foods2_4, SwingConstants.CENTER); foods2_4.setPreferredSize(new Dimension(220, 45)); - foods2_4.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - foods2_4.setForeground(Color.black);//设置文字的颜色 + foods2_4.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + foods2_4.setForeground(Color.black); foods2_4.setOpaque(true); foods2_4.setBackground(new Color(252, 250, 250)); gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 3; - gbc2.gridy = 4; + gbc2.gridx = 3; // 第3列 + gbc2.gridy = 4; // 第4行 gbl2.setConstraints(foods2_4, gbc2); middlePanel2.add(foods2_4); + +// 创建显示第十四个乘客备注信息的标签 JLabel note2_4 = new JLabel(Note2_4, SwingConstants.CENTER); note2_4.setPreferredSize(new Dimension(220, 45)); - note2_4.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - note2_4.setForeground(Color.black);//设置文字的颜色 + note2_4.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + note2_4.setForeground(Color.black); note2_4.setOpaque(true); note2_4.setBackground(new Color(252, 250, 250)); gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 4; - gbc2.gridy = 4; + gbc2.gridx = 4; // 第4列 + gbc2.gridy = 4; // 第4行 gbl2.setConstraints(note2_4, gbc2); middlePanel2.add(note2_4); + + // 声明第二页第五个乘客的信息变量 String Name2_5 = ""; - String State2_5 =""; - String Seats2_5 =""; - String Foods2_5 =""; + String State2_5 = ""; + String Seats2_5 = ""; + String Foods2_5 = ""; String Note2_5 = ""; - if(passenger_num>=15) { + +// 如果乘客数量大于等于15,则处理第十五个乘客的信息 + if (passenger_num >= 15) { + // 将第十五个乘客的信息字符串按空格分割成数组 String[] information2_5 = information.get(14).split("\\s+"); + // 通过乘客订单对象获取乘客姓名 Name2_5 = po.findName(information2_5[0]); + // 获取乘客状态信息(索引为5) State2_5 = information2_5[5]; - if(!information2_5[3].equals("LETTERUNCHOSEN")&&!information2_5[4].equals("NUMBERUNCHOSEN")) { + // 如果座位字母和数字都已选择,则组合成完整座位号 + if (!information2_5[3].equals("LETTERUNCHOSEN") && !information2_5[4].equals("NUMBERUNCHOSEN")) { Seats2_5 = information2_5[3] + information2_5[4]; } - if(!information2_5[2].equals("FOODUNCHOSEN")){ + // 如果已选择餐食,则获取餐食信息 + if (!information2_5[2].equals("FOODUNCHOSEN")) { Foods2_5 = information2_5[2]; } - if(information2_5.length>9) { - LENGTH=information2_5.length; - while(LENGTH>=9) { - Note2_5 = information2_5[LENGTH-2]+" "+Note2_5; - LENGTH=LENGTH-1; + // 如果信息数组长度大于9,说明有备注信息需要处理 + if (information2_5.length > 9) { + LENGTH = information2_5.length; + // 循环处理备注信息,从后往前拼接 + while (LENGTH >= 9) { + Note2_5 = information2_5[LENGTH - 2] + " " + Note2_5; + LENGTH = LENGTH - 1; } - }else{ + } else { + // 如果信息数组长度不大于9,检查是否有备注信息 if (information2_5[7].equals("NOTE")) { - Note2_5 = ""; + Note2_5 = ""; // 没有备注信息 } else { - Note2_5 = information2_5[7]; + Note2_5 = information2_5[7]; // 获取备注信息 } } } - JLabel name2_5 = new JLabel(Name2_5,SwingConstants.CENTER); - name2_5.setPreferredSize(new Dimension(220, 45)); - name2_5.setOpaque(true); - name2_5.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - name2_5.setForeground(Color.black);//设置文字的颜色 - name2_5.setBackground(new Color(232, 232, 232)); + +// 创建显示第十五个乘客姓名的标签 + JLabel name2_5 = new JLabel(Name2_5, SwingConstants.CENTER); + name2_5.setPreferredSize(new Dimension(220, 45)); // 设置标签尺寸 + name2_5.setOpaque(true); // 设置为不透明 + name2_5.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); // 设置字体 + name2_5.setForeground(Color.black); // 设置文字颜色 + name2_5.setBackground(new Color(232, 232, 232)); // 设置背景颜色(深灰色) +// 设置网格布局约束条件 gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 0; - gbc2.gridy = 5; + gbc2.gridx = 0; // 第0列 + gbc2.gridy = 5; // 第5行 gbl2.setConstraints(name2_5, gbc2); - middlePanel2.add(name2_5); + middlePanel2.add(name2_5); // 添加到中间面板 + +// 创建显示第十五个乘客状态的标签 JLabel state2_5 = new JLabel(State2_5, SwingConstants.CENTER); state2_5.setPreferredSize(new Dimension(220, 45)); - state2_5.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - state2_5.setForeground(Color.black);//设置文字的颜色 + state2_5.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + state2_5.setForeground(Color.black); state2_5.setOpaque(true); state2_5.setBackground(new Color(232, 232, 232)); gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 1; - gbc2.gridy = 5; + gbc2.gridx = 1; // 第1列 + gbc2.gridy = 5; // 第5行 gbl2.setConstraints(state2_5, gbc2); middlePanel2.add(state2_5); + +// 创建显示第十五个乘客座位号的标签 JLabel seats2_5 = new JLabel(Seats2_5, SwingConstants.CENTER); seats2_5.setPreferredSize(new Dimension(220, 45)); - seats2_5.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - seats2_5.setForeground(Color.black);//设置文字的颜色 + seats2_5.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + seats2_5.setForeground(Color.black); seats2_5.setOpaque(true); seats2_5.setBackground(new Color(232, 232, 232)); gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 2; - gbc2.gridy = 5; + gbc2.gridx = 2; // 第2列 + gbc2.gridy = 5; // 第5行 gbl2.setConstraints(seats2_5, gbc2); middlePanel2.add(seats2_5); + +// 创建显示第十五个乘客餐食选择的标签 JLabel foods2_5 = new JLabel(Foods2_5, SwingConstants.CENTER); foods2_5.setPreferredSize(new Dimension(220, 45)); - foods2_5.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - foods2_5.setForeground(Color.black);//设置文字的颜色 + foods2_5.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + foods2_5.setForeground(Color.black); foods2_5.setOpaque(true); foods2_5.setBackground(new Color(232, 232, 232)); gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 3; - gbc2.gridy = 5; + gbc2.gridx = 3; // 第3列 + gbc2.gridy = 5; // 第5行 gbl2.setConstraints(foods2_5, gbc2); middlePanel2.add(foods2_5); + +// 创建显示第十五个乘客备注信息的标签 JLabel note2_5 = new JLabel(Note2_5, SwingConstants.CENTER); note2_5.setPreferredSize(new Dimension(220, 45)); - note2_5.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - note2_5.setForeground(Color.black);//设置文字的颜色 + note2_5.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + note2_5.setForeground(Color.black); note2_5.setOpaque(true); note2_5.setBackground(new Color(232, 232, 232)); gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 4; - gbc2.gridy = 5; + gbc2.gridx = 4; // 第4列 + gbc2.gridy = 5; // 第5行 gbl2.setConstraints(note2_5, gbc2); middlePanel2.add(note2_5); +// 声明第二页第六个乘客的信息变量 String Name2_6 = ""; - String State2_6 =""; - String Seats2_6 =""; - String Foods2_6 =""; + String State2_6 = ""; + String Seats2_6 = ""; + String Foods2_6 = ""; String Note2_6 = ""; - if(passenger_num>=16) { + +// 如果乘客数量大于等于16,则处理第十六个乘客的信息 + if (passenger_num >= 16) { + // 将第十六个乘客的信息字符串按空格分割成数组 String[] information2_6 = information.get(15).split("\\s+"); + // 通过乘客订单对象获取乘客姓名 Name2_6 = po.findName(information2_6[0]); + // 获取乘客状态信息(索引为5) State2_6 = information2_6[5]; - if(!information2_6[3].equals("LETTERUNCHOSEN")&&!information2_6[4].equals("NUMBERUNCHOSEN")) { + // 如果座位字母和数字都已选择,则组合成完整座位号 + if (!information2_6[3].equals("LETTERUNCHOSEN") && !information2_6[4].equals("NUMBERUNCHOSEN")) { Seats2_6 = information2_6[3] + information2_6[4]; } - if(!information2_6[2].equals("FOODUNCHOSEN")){ + // 如果已选择餐食,则获取餐食信息 + if (!information2_6[2].equals("FOODUNCHOSEN")) { Foods2_6 = information2_6[2]; } - if(information2_6.length>9) { - LENGTH=information2_6.length; - while(LENGTH>=9) { - Note2_6 = information2_6[LENGTH-2]+" "+Note2_6; - LENGTH=LENGTH-1; + // 如果信息数组长度大于9,说明有备注信息需要处理 + if (information2_6.length > 9) { + LENGTH = information2_6.length; + // 循环处理备注信息,从后往前拼接 + while (LENGTH >= 9) { + Note2_6 = information2_6[LENGTH - 2] + " " + Note2_6; + LENGTH = LENGTH - 1; } - }else{ + } else { + // 如果信息数组长度不大于9,检查是否有备注信息 if (information2_6[7].equals("NOTE")) { - Note2_6 = ""; + Note2_6 = ""; // 没有备注信息 } else { - Note2_6 = information2_6[7]; + Note2_6 = information2_6[7]; // 获取备注信息 } } } - JLabel name2_6 = new JLabel(Name2_6,SwingConstants.CENTER); - name2_6.setPreferredSize(new Dimension(220, 45)); - name2_6.setOpaque(true); - name2_6.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - name2_6.setForeground(Color.black);//设置文字的颜色 - name2_6.setBackground(new Color(252, 250, 250)); + +// 创建显示第十六个乘客姓名的标签 + JLabel name2_6 = new JLabel(Name2_6, SwingConstants.CENTER); + name2_6.setPreferredSize(new Dimension(220, 45)); // 设置标签尺寸 + name2_6.setOpaque(true); // 设置为不透明 + name2_6.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); // 设置字体 + name2_6.setForeground(Color.black); // 设置文字颜色 + name2_6.setBackground(new Color(252, 250, 250)); // 设置背景颜色(浅灰色) +// 设置网格布局约束条件 gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 0; - gbc2.gridy = 6; + gbc2.gridx = 0; // 第0列 + gbc2.gridy = 6; // 第6行 gbl2.setConstraints(name2_6, gbc2); - middlePanel2.add(name2_6); + middlePanel2.add(name2_6); // 添加到中间面板 + +// 创建显示第十六个乘客状态的标签 JLabel state2_6 = new JLabel(State2_6, SwingConstants.CENTER); state2_6.setPreferredSize(new Dimension(220, 45)); - state2_6.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - state2_6.setForeground(Color.black);//设置文字的颜色 + state2_6.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + state2_6.setForeground(Color.black); state2_6.setOpaque(true); state2_6.setBackground(new Color(252, 250, 250)); gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 1; - gbc2.gridy = 6; + gbc2.gridx = 1; // 第1列 + gbc2.gridy = 6; // 第6行 gbl2.setConstraints(state2_6, gbc2); middlePanel2.add(state2_6); + +// 创建显示第十六个乘客座位号的标签 JLabel seats2_6 = new JLabel(Seats2_6, SwingConstants.CENTER); seats2_6.setPreferredSize(new Dimension(220, 45)); - seats2_6.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - seats2_6.setForeground(Color.black);//设置文字的颜色 + seats2_6.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + seats2_6.setForeground(Color.black); seats2_6.setOpaque(true); seats2_6.setBackground(new Color(252, 250, 250)); gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 2; - gbc2.gridy = 6; + gbc2.gridx = 2; // 第2列 + gbc2.gridy = 6; // 第6行 gbl2.setConstraints(seats2_6, gbc2); middlePanel2.add(seats2_6); + +// 创建显示第十六个乘客餐食选择的标签 JLabel foods2_6 = new JLabel(Foods2_6, SwingConstants.CENTER); foods2_6.setPreferredSize(new Dimension(220, 45)); - foods2_6.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - foods2_6.setForeground(Color.black);//设置文字的颜色 + foods2_6.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + foods2_6.setForeground(Color.black); foods2_6.setOpaque(true); foods2_6.setBackground(new Color(252, 250, 250)); gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 3; - gbc2.gridy = 6; + gbc2.gridx = 3; // 第3列 + gbc2.gridy = 6; // 第6行 gbl2.setConstraints(foods2_6, gbc2); middlePanel2.add(foods2_6); + +// 创建显示第十六个乘客备注信息的标签 JLabel note2_6 = new JLabel(Note2_6, SwingConstants.CENTER); note2_6.setPreferredSize(new Dimension(220, 45)); - note2_6.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - note2_6.setForeground(Color.black);//设置文字的颜色 + note2_6.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + note2_6.setForeground(Color.black); note2_6.setOpaque(true); note2_6.setBackground(new Color(252, 250, 250)); gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 4; - gbc2.gridy = 6; + gbc2.gridx = 4; // 第4列 + gbc2.gridy = 6; // 第6行 gbl2.setConstraints(note2_6, gbc2); middlePanel2.add(note2_6); - +// 声明第二页第七个乘客的信息变量 String Name2_7 = ""; - String State2_7 =""; - String Seats2_7 =""; - String Foods2_7 =""; + String State2_7 = ""; + String Seats2_7 = ""; + String Foods2_7 = ""; String Note2_7 = ""; - if(passenger_num>=17) { + +// 如果乘客数量大于等于17,则处理第十七个乘客的信息 + if (passenger_num >= 17) { + // 将第十七个乘客的信息字符串按空格分割成数组 String[] information2_7 = information.get(16).split("\\s+"); + // 通过乘客订单对象获取乘客姓名 Name2_7 = po.findName(information2_7[0]); + // 获取乘客状态信息(索引为5) State2_7 = information2_7[5]; - if(!information2_7[3].equals("LETTERUNCHOSEN")&&!information2_7[4].equals("NUMBERUNCHOSEN")) { + // 如果座位字母和数字都已选择,则组合成完整座位号 + if (!information2_7[3].equals("LETTERUNCHOSEN") && !information2_7[4].equals("NUMBERUNCHOSEN")) { Seats2_7 = information2_7[3] + information2_7[4]; } - if(!information2_7[2].equals("FOODUNCHOSEN")){ + // 如果已选择餐食,则获取餐食信息 + if (!information2_7[2].equals("FOODUNCHOSEN")) { Foods2_7 = information2_7[2]; } - if(information2_7.length>9) { - LENGTH=information2_7.length; - while(LENGTH>=9) { - Note2_7 = information2_7[LENGTH-2]+" "+Note2_7; - LENGTH=LENGTH-1; + // 如果信息数组长度大于9,说明有备注信息需要处理 + if (information2_7.length > 9) { + LENGTH = information2_7.length; + // 循环处理备注信息,从后往前拼接 + while (LENGTH >= 9) { + Note2_7 = information2_7[LENGTH - 2] + " " + Note2_7; + LENGTH = LENGTH - 1; } - }else{ + } else { + // 如果信息数组长度不大于9,检查是否有备注信息 if (information2_7[7].equals("NOTE")) { - Note2_7 = ""; + Note2_7 = ""; // 没有备注信息 } else { - Note2_7 = information2_7[7]; + Note2_7 = information2_7[7]; // 获取备注信息 } } } - JLabel name2_7 = new JLabel(Name2_7,SwingConstants.CENTER); - name2_7.setPreferredSize(new Dimension(220, 45)); - name2_7.setOpaque(true); - name2_7.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - name2_7.setForeground(Color.black);//设置文字的颜色 - name2_7.setBackground(new Color(232, 232, 232)); + +// 创建显示第十七个乘客姓名的标签 + JLabel name2_7 = new JLabel(Name2_7, SwingConstants.CENTER); + name2_7.setPreferredSize(new Dimension(220, 45)); // 设置标签尺寸 + name2_7.setOpaque(true); // 设置为不透明 + name2_7.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); // 设置字体 + name2_7.setForeground(Color.black); // 设置文字颜色 + name2_7.setBackground(new Color(232, 232, 232)); // 设置背景颜色(深灰色) +// 设置网格布局约束条件 gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 0; - gbc2.gridy = 7; + gbc2.gridx = 0; // 第0列 + gbc2.gridy = 7; // 第7行 gbl2.setConstraints(name2_7, gbc2); - middlePanel2.add(name2_7); + middlePanel2.add(name2_7); // 添加到中间面板 + +// 创建显示第十七个乘客状态的标签 JLabel state2_7 = new JLabel(State2_7, SwingConstants.CENTER); state2_7.setPreferredSize(new Dimension(220, 45)); - state2_7.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - state2_7.setForeground(Color.black);//设置文字的颜色 + state2_7.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + state2_7.setForeground(Color.black); state2_7.setOpaque(true); state2_7.setBackground(new Color(232, 232, 232)); gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 1; - gbc2.gridy = 7; + gbc2.gridx = 1; // 第1列 + gbc2.gridy = 7; // 第7行 gbl2.setConstraints(state2_7, gbc2); middlePanel2.add(state2_7); + +// 创建显示第十七个乘客座位号的标签 JLabel seats2_7 = new JLabel(Seats2_7, SwingConstants.CENTER); seats2_7.setPreferredSize(new Dimension(220, 45)); - seats2_7.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - seats2_7.setForeground(Color.black);//设置文字的颜色 + seats2_7.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + seats2_7.setForeground(Color.black); seats2_7.setOpaque(true); seats2_7.setBackground(new Color(232, 232, 232)); gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 2; - gbc2.gridy = 7; + gbc2.gridx = 2; // 第2列 + gbc2.gridy = 7; // 第7行 gbl2.setConstraints(seats2_7, gbc2); middlePanel2.add(seats2_7); + +// 创建显示第十七个乘客餐食选择的标签 JLabel foods2_7 = new JLabel(Foods2_7, SwingConstants.CENTER); foods2_7.setPreferredSize(new Dimension(220, 45)); - foods2_7.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - foods2_7.setForeground(Color.black);//设置文字的颜色 + foods2_7.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + foods2_7.setForeground(Color.black); foods2_7.setOpaque(true); foods2_7.setBackground(new Color(232, 232, 232)); gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 3; - gbc2.gridy = 7; + gbc2.gridx = 3; // 第3列 + gbc2.gridy = 7; // 第7行 gbl2.setConstraints(foods2_7, gbc2); middlePanel2.add(foods2_7); + +// 创建显示第十七个乘客备注信息的标签 JLabel note2_7 = new JLabel(Note2_7, SwingConstants.CENTER); note2_7.setPreferredSize(new Dimension(220, 45)); - note2_7.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - note2_7.setForeground(Color.black);//设置文字的颜色 + note2_7.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + note2_7.setForeground(Color.black); note2_7.setOpaque(true); note2_7.setBackground(new Color(232, 232, 232)); gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 4; - gbc2.gridy = 7; + gbc2.gridx = 4; // 第4列 + gbc2.gridy = 7; // 第7行 gbl2.setConstraints(note2_7, gbc2); middlePanel2.add(note2_7); + + // 声明第二页第八个乘客的信息变量 String Name2_8 = ""; - String State2_8 =""; - String Seats2_8 =""; - String Foods2_8 =""; + String State2_8 = ""; + String Seats2_8 = ""; + String Foods2_8 = ""; String Note2_8 = ""; - if(passenger_num>=18) { + +// 如果乘客数量大于等于18,则处理第十八个乘客的信息 + if (passenger_num >= 18) { + // 将第十八个乘客的信息字符串按空格分割成数组 String[] information2_8 = information.get(17).split("\\s+"); + // 通过乘客订单对象获取乘客姓名 Name2_8 = po.findName(information2_8[0]); + // 获取乘客状态信息(索引为5) State2_8 = information2_8[5]; - if(!information2_8[3].equals("LETTERUNCHOSEN")&&!information2_8[4].equals("NUMBERUNCHOSEN")) { + // 如果座位字母和数字都已选择,则组合成完整座位号 + if (!information2_8[3].equals("LETTERUNCHOSEN") && !information2_8[4].equals("NUMBERUNCHOSEN")) { Seats2_8 = information2_8[3] + information2_8[4]; } - if(!information2_8[2].equals("FOODUNCHOSEN")){ + // 如果已选择餐食,则获取餐食信息 + if (!information2_8[2].equals("FOODUNCHOSEN")) { Foods2_8 = information2_8[2]; } - if(information2_8.length>9) { - LENGTH=information2_8.length; - while(LENGTH>=9) { - Note2_8 = information2_8[LENGTH-2]+" "+Note2_8; - LENGTH=LENGTH-1; + // 如果信息数组长度大于9,说明有备注信息需要处理 + if (information2_8.length > 9) { + LENGTH = information2_8.length; + // 循环处理备注信息,从后往前拼接 + while (LENGTH >= 9) { + Note2_8 = information2_8[LENGTH - 2] + " " + Note2_8; + LENGTH = LENGTH - 1; } - }else{ + } else { + // 如果信息数组长度不大于9,检查是否有备注信息 if (information2_8[7].equals("NOTE")) { - Note2_8 = ""; + Note2_8 = ""; // 没有备注信息 } else { - Note2_8 = information2_8[7]; + Note2_8 = information2_8[7]; // 获取备注信息 } } } - JLabel name2_8 = new JLabel(Name2_8,SwingConstants.CENTER); - name2_8.setPreferredSize(new Dimension(220, 45)); - name2_8.setOpaque(true); - name2_8.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - name2_8.setForeground(Color.black);//设置文字的颜色 - name2_8.setBackground(new Color(252, 250, 250)); + +// 创建显示第十八个乘客姓名的标签 + JLabel name2_8 = new JLabel(Name2_8, SwingConstants.CENTER); + name2_8.setPreferredSize(new Dimension(220, 45)); // 设置标签尺寸 + name2_8.setOpaque(true); // 设置为不透明 + name2_8.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); // 设置字体 + name2_8.setForeground(Color.black); // 设置文字颜色 + name2_8.setBackground(new Color(252, 250, 250)); // 设置背景颜色(浅灰色) +// 设置网格布局约束条件 gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 0; - gbc2.gridy = 8; + gbc2.gridx = 0; // 第0列 + gbc2.gridy = 8; // 第8行 gbl2.setConstraints(name2_8, gbc2); - middlePanel2.add(name2_8); + middlePanel2.add(name2_8); // 添加到中间面板 + +// 创建显示第十八个乘客状态的标签 JLabel state2_8 = new JLabel(State2_8, SwingConstants.CENTER); state2_8.setPreferredSize(new Dimension(220, 45)); - state2_8.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - state2_8.setForeground(Color.black);//设置文字的颜色 + state2_8.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + state2_8.setForeground(Color.black); state2_8.setOpaque(true); state2_8.setBackground(new Color(252, 250, 250)); gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 1; - gbc2.gridy = 8; + gbc2.gridx = 1; // 第1列 + gbc2.gridy = 8; // 第8行 gbl2.setConstraints(state2_8, gbc2); middlePanel2.add(state2_8); + +// 创建显示第十八个乘客座位号的标签 JLabel seats2_8 = new JLabel(Seats2_8, SwingConstants.CENTER); seats2_8.setPreferredSize(new Dimension(220, 45)); - seats2_8.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - seats2_8.setForeground(Color.black);//设置文字的颜色 + seats2_8.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + seats2_8.setForeground(Color.black); seats2_8.setOpaque(true); seats2_8.setBackground(new Color(252, 250, 250)); gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 2; - gbc2.gridy = 8; + gbc2.gridx = 2; // 第2列 + gbc2.gridy = 8; // 第8行 gbl2.setConstraints(seats2_8, gbc2); middlePanel2.add(seats2_8); + +// 创建显示第十八个乘客餐食选择的标签 JLabel foods2_8 = new JLabel(Foods2_8, SwingConstants.CENTER); foods2_8.setPreferredSize(new Dimension(220, 45)); - foods2_8.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - foods2_8.setForeground(Color.black);//设置文字的颜色 + foods2_8.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + foods2_8.setForeground(Color.black); foods2_8.setOpaque(true); foods2_8.setBackground(new Color(252, 250, 250)); gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 3; - gbc2.gridy = 8; + gbc2.gridx = 3; // 第3列 + gbc2.gridy = 8; // 第8行 gbl2.setConstraints(foods2_8, gbc2); middlePanel2.add(foods2_8); + +// 创建显示第十八个乘客备注信息的标签 JLabel note2_8 = new JLabel(Note2_8, SwingConstants.CENTER); note2_8.setPreferredSize(new Dimension(220, 45)); - note2_8.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - note2_8.setForeground(Color.black);//设置文字的颜色 + note2_8.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + note2_8.setForeground(Color.black); note2_8.setOpaque(true); note2_8.setBackground(new Color(252, 250, 250)); gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 4; - gbc2.gridy = 8; + gbc2.gridx = 4; // 第4列 + gbc2.gridy = 8; // 第8行 gbl2.setConstraints(note2_8, gbc2); middlePanel2.add(note2_8); +// 声明第二页第九个乘客的信息变量 String Name2_9 = ""; - String State2_9 =""; - String Seats2_9 =""; - String Foods2_9 =""; + String State2_9 = ""; + String Seats2_9 = ""; + String Foods2_9 = ""; String Note2_9 = ""; - if(passenger_num>=19) { + +// 如果乘客数量大于等于19,则处理第十九个乘客的信息 + if (passenger_num >= 19) { + // 将第十九个乘客的信息字符串按空格分割成数组 String[] information2_9 = information.get(18).split("\\s+"); + // 通过乘客订单对象获取乘客姓名 Name2_9 = po.findName(information2_9[0]); + // 获取乘客状态信息(索引为5) State2_9 = information2_9[5]; - if(!information2_9[3].equals("LETTERUNCHOSEN")&&!information2_9[4].equals("NUMBERUNCHOSEN")) { + // 如果座位字母和数字都已选择,则组合成完整座位号 + if (!information2_9[3].equals("LETTERUNCHOSEN") && !information2_9[4].equals("NUMBERUNCHOSEN")) { Seats2_9 = information2_9[3] + information2_9[4]; } - if(!information2_9[2].equals("FOODUNCHOSEN")){ + // 如果已选择餐食,则获取餐食信息 + if (!information2_9[2].equals("FOODUNCHOSEN")) { Foods2_9 = information2_9[2]; } - if(information2_9.length>9) { - LENGTH=information2_9.length; - while(LENGTH>=9) { - Note2_9 = information2_9[LENGTH-2]+" "+Note2_9; - LENGTH=LENGTH-1; + // 如果信息数组长度大于9,说明有备注信息需要处理 + if (information2_9.length > 9) { + LENGTH = information2_9.length; + // 循环处理备注信息,从后往前拼接 + while (LENGTH >= 9) { + Note2_9 = information2_9[LENGTH - 2] + " " + Note2_9; + LENGTH = LENGTH - 1; } - }else{ + } else { + // 如果信息数组长度不大于9,检查是否有备注信息 if (information2_9[7].equals("NOTE")) { - Note2_9 = ""; + Note2_9 = ""; // 没有备注信息 } else { - Note2_9 = information2_9[7]; + Note2_9 = information2_9[7]; // 获取备注信息 } } } - JLabel name2_9 = new JLabel(Name2_9,SwingConstants.CENTER); - name2_9.setPreferredSize(new Dimension(220, 45)); - name2_9.setOpaque(true); - name2_9.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - name2_9.setForeground(Color.black);//设置文字的颜色 - name2_9.setBackground(new Color(232, 232, 232)); + +// 创建显示第十九个乘客姓名的标签 + JLabel name2_9 = new JLabel(Name2_9, SwingConstants.CENTER); + name2_9.setPreferredSize(new Dimension(220, 45)); // 设置标签尺寸 + name2_9.setOpaque(true); // 设置为不透明 + name2_9.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); // 设置字体 + name2_9.setForeground(Color.black); // 设置文字颜色 + name2_9.setBackground(new Color(232, 232, 232)); // 设置背景颜色(深灰色) +// 设置网格布局约束条件 gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 0; - gbc2.gridy = 9; + gbc2.gridx = 0; // 第0列 + gbc2.gridy = 9; // 第9行 gbl2.setConstraints(name2_9, gbc2); - middlePanel2.add(name2_9); + middlePanel2.add(name2_9); // 添加到中间面板 + +// 创建显示第十九个乘客状态的标签 JLabel state2_9 = new JLabel(State2_9, SwingConstants.CENTER); state2_9.setPreferredSize(new Dimension(220, 45)); - state2_9.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - state2_9.setForeground(Color.black);//设置文字的颜色 + state2_9.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + state2_9.setForeground(Color.black); state2_9.setOpaque(true); state2_9.setBackground(new Color(232, 232, 232)); gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 1; - gbc2.gridy = 9; + gbc2.gridx = 1; // 第1列 + gbc2.gridy = 9; // 第9行 gbl2.setConstraints(state2_9, gbc2); middlePanel2.add(state2_9); + +// 创建显示第十九个乘客座位号的标签 JLabel seats2_9 = new JLabel(Seats2_9, SwingConstants.CENTER); seats2_9.setPreferredSize(new Dimension(220, 45)); - seats2_9.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - seats2_9.setForeground(Color.black);//设置文字的颜色 + seats2_9.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + seats2_9.setForeground(Color.black); seats2_9.setOpaque(true); seats2_9.setBackground(new Color(232, 232, 232)); gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 2; - gbc2.gridy = 9; + gbc2.gridx = 2; // 第2列 + gbc2.gridy = 9; // 第9行 gbl2.setConstraints(seats2_9, gbc2); middlePanel2.add(seats2_9); + +// 创建显示第十九个乘客餐食选择的标签 JLabel foods2_9 = new JLabel(Foods2_9, SwingConstants.CENTER); foods2_9.setPreferredSize(new Dimension(220, 45)); - foods2_9.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - foods2_9.setForeground(Color.black);//设置文字的颜色 + foods2_9.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + foods2_9.setForeground(Color.black); foods2_9.setOpaque(true); foods2_9.setBackground(new Color(232, 232, 232)); gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 3; - gbc2.gridy = 9; + gbc2.gridx = 3; // 第3列 + gbc2.gridy = 9; // 第9行 gbl2.setConstraints(foods2_9, gbc2); middlePanel2.add(foods2_9); + +// 创建显示第十九个乘客备注信息的标签 JLabel note2_9 = new JLabel(Note2_9, SwingConstants.CENTER); note2_9.setPreferredSize(new Dimension(220, 45)); - note2_9.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - note2_9.setForeground(Color.black);//设置文字的颜色 + note2_9.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + note2_9.setForeground(Color.black); note2_9.setOpaque(true); note2_9.setBackground(new Color(232, 232, 232)); gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 4; - gbc2.gridy = 9; + gbc2.gridx = 4; // 第4列 + gbc2.gridy = 9; // 第9行 gbl2.setConstraints(note2_9, gbc2); middlePanel2.add(note2_9); +// 声明第二页第十个乘客的信息变量 String Name2_10 = ""; - String State2_10 =""; - String Seats2_10 =""; - String Foods2_10 =""; + String State2_10 = ""; + String Seats2_10 = ""; + String Foods2_10 = ""; String Note2_10 = ""; - if(passenger_num>=20) { + +// 如果乘客数量大于等于20,则处理第二十个乘客的信息 + if (passenger_num >= 20) { + // 将第二十个乘客的信息字符串按空格分割成数组 String[] information2_10 = information.get(19).split("\\s+"); + // 通过乘客订单对象获取乘客姓名 Name2_10 = po.findName(information2_10[0]); + // 获取乘客状态信息(索引为5) State2_10 = information2_10[5]; - if(!information2_10[3].equals("LETTERUNCHOSEN")&&!information2_10[4].equals("NUMBERUNCHOSEN")) { + // 如果座位字母和数字都已选择,则组合成完整座位号 + if (!information2_10[3].equals("LETTERUNCHOSEN") && !information2_10[4].equals("NUMBERUNCHOSEN")) { Seats2_10 = information2_10[3] + information2_10[4]; } - if(!information2_10[2].equals("FOODUNCHOSEN")){ + // 如果已选择餐食,则获取餐食信息 + if (!information2_10[2].equals("FOODUNCHOSEN")) { Foods2_10 = information2_10[2]; } - if(information2_10.length>9) { - LENGTH=information2_10.length; - while(LENGTH>=9) { - Note2_10 = information2_10[LENGTH-2]+" "+Note2_10; - LENGTH=LENGTH-1; + // 如果信息数组长度大于9,说明有备注信息需要处理 + if (information2_10.length > 9) { + LENGTH = information2_10.length; + // 循环处理备注信息,从后往前拼接 + while (LENGTH >= 9) { + Note2_10 = information2_10[LENGTH - 2] + " " + Note2_10; + LENGTH = LENGTH - 1; } - }else{ + } else { + // 如果信息数组长度不大于9,检查是否有备注信息 if (information2_10[7].equals("NOTE")) { - Note2_10 = ""; + Note2_10 = ""; // 没有备注信息 } else { - Note2_10 = information2_10[7]; + Note2_10 = information2_10[7]; // 获取备注信息 } } } - JLabel name2_10 = new JLabel(Name2_10,SwingConstants.CENTER); - name2_10.setPreferredSize(new Dimension(220, 45)); - name2_10.setOpaque(true); - name2_10.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - name2_10.setForeground(Color.black);//设置文字的颜色 - name2_10.setBackground(new Color(252, 250, 250)); + +// 创建显示第二十个乘客姓名的标签 + JLabel name2_10 = new JLabel(Name2_10, SwingConstants.CENTER); + name2_10.setPreferredSize(new Dimension(220, 45)); // 设置标签尺寸 + name2_10.setOpaque(true); // 设置为不透明 + name2_10.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); // 设置字体 + name2_10.setForeground(Color.black); // 设置文字颜色 + name2_10.setBackground(new Color(252, 250, 250)); // 设置背景颜色(浅灰色) +// 设置网格布局约束条件 gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 0; - gbc2.gridy = 10; + gbc2.gridx = 0; // 第0列 + gbc2.gridy = 10; // 第10行 gbl2.setConstraints(name2_10, gbc2); - middlePanel2.add(name2_10); + middlePanel2.add(name2_10); // 添加到中间面板 + +// 创建显示第二十个乘客状态的标签 JLabel state2_10 = new JLabel(State2_10, SwingConstants.CENTER); state2_10.setPreferredSize(new Dimension(220, 45)); - state2_10.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - state2_10.setForeground(Color.black);//设置文字的颜色 + state2_10.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + state2_10.setForeground(Color.black); state2_10.setOpaque(true); state2_10.setBackground(new Color(252, 250, 250)); gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 1; - gbc2.gridy = 10; + gbc2.gridx = 1; // 第1列 + gbc2.gridy = 10; // 第10行 gbl2.setConstraints(state2_10, gbc2); middlePanel2.add(state2_10); + +// 创建显示第二十个乘客座位号的标签 JLabel seats2_10 = new JLabel(Seats2_10, SwingConstants.CENTER); seats2_10.setPreferredSize(new Dimension(220, 45)); - seats2_10.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - seats2_10.setForeground(Color.black);//设置文字的颜色 + seats2_10.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + seats2_10.setForeground(Color.black); seats2_10.setOpaque(true); seats2_10.setBackground(new Color(252, 250, 250)); gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 2; - gbc2.gridy = 10; + gbc2.gridx = 2; // 第2列 + gbc2.gridy = 10; // 第10行 gbl2.setConstraints(seats2_10, gbc2); middlePanel2.add(seats2_10); + +// 创建显示第二十个乘客餐食选择的标签 JLabel foods2_10 = new JLabel(Foods2_10, SwingConstants.CENTER); foods2_10.setPreferredSize(new Dimension(220, 45)); - foods2_10.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - foods2_10.setForeground(Color.black);//设置文字的颜色 + foods2_10.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + foods2_10.setForeground(Color.black); foods2_10.setOpaque(true); foods2_10.setBackground(new Color(252, 250, 250)); gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 3; - gbc2.gridy = 10; + gbc2.gridx = 3; // 第3列 + gbc2.gridy = 10; // 第10行 gbl2.setConstraints(foods2_10, gbc2); middlePanel2.add(foods2_10); + +// 创建显示第二十个乘客备注信息的标签 JLabel note2_10 = new JLabel(Note2_10, SwingConstants.CENTER); note2_10.setPreferredSize(new Dimension(220, 45)); - note2_10.setFont(new Font(Font.DIALOG, Font.PLAIN, 20));//设置文字字体 - note2_10.setForeground(Color.black);//设置文字的颜色 + note2_10.setFont(new Font(Font.DIALOG, Font.PLAIN, 20)); + note2_10.setForeground(Color.black); note2_10.setOpaque(true); note2_10.setBackground(new Color(252, 250, 250)); gbc2.weightx = 0.2; // 指定组件的分配区域 gbc2.weighty = 0.09; gbc2.gridwidth = 1; gbc2.gridheight = 1; - gbc2.gridx = 4; - gbc2.gridy = 10; + gbc2.gridx = 4; // 第4列 + gbc2.gridy = 10; // 第10行 gbl2.setConstraints(note2_10, gbc2); middlePanel2.add(note2_10); +// 将中间信息面板添加到第二页面板中 p2.add(middlePanel2); - panel.add(p2,"2"); +// 将第二页面板添加到主面板中,标识为"2" + panel.add(p2, "2"); - c.show(panel,"1"); +// 使用卡片布局管理器显示第一页 + c.show(panel, "1"); +// 为"下一页"按钮添加事件监听器 button_right.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - if(pageNum==1) { - c.show(panel,"2"); + // 如果当前显示的是第一页 + if (pageNum == 1) { + // 显示第二页 + c.show(panel, "2"); + // 更新页码 pageNum++; + // 隐藏"下一页"按钮,显示"上一页"按钮 button_right.setVisible(false); button_left.setVisible(true); } @@ -2298,13 +2778,17 @@ public class Admin_Information extends JPanel { }); +// 为"上一页"按钮添加事件监听器 button_left.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - - if(pageNum==2){ - c.show(panel,"1"); + // 如果当前显示的是第二页 + if (pageNum == 2) { + // 显示第一页 + c.show(panel, "1"); + // 更新页码 pageNum--; + // 隐藏"上一页"按钮,显示"下一页"按钮 button_left.setVisible(false); button_right.setVisible(true); } @@ -2313,7 +2797,5 @@ public class Admin_Information extends JPanel { }); - - } -} +} \ No newline at end of file diff --git a/src/airline-develop/src/frame/UserPanel/Check_in_bookingNum_Panel.java b/src/airline-develop/src/frame/UserPanel/Check_in_bookingNum_Panel.java index e000f97..a91fd74 100644 --- a/src/airline-develop/src/frame/UserPanel/Check_in_bookingNum_Panel.java +++ b/src/airline-develop/src/frame/UserPanel/Check_in_bookingNum_Panel.java @@ -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 + ; // 若没有内容,则不执行删除 } }); - - - - - - } - - - - - - - } - - -