114 lines
3.9 KiB
Java
114 lines
3.9 KiB
Java
package xjdx.rjxy.airplane.view;
|
|
|
|
import javax.swing.*;
|
|
import java.awt.*;
|
|
import java.awt.event.ActionEvent;
|
|
import java.awt.event.ActionListener;
|
|
|
|
public class ShowOrder extends JFrame implements ActionListener {
|
|
|
|
JTextField nameTextField, idCardTextField;
|
|
JButton backBtn, OKBtn;
|
|
private Icon okBtnIco = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\OK.png");
|
|
|
|
public ShowOrder() {
|
|
super("飞机订票系统 v1.0>>订单查询");
|
|
//改变按钮样式
|
|
try {
|
|
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
|
|
} catch (ClassNotFoundException e) {
|
|
throw new RuntimeException(e);
|
|
} catch (InstantiationException e) {
|
|
throw new RuntimeException(e);
|
|
} catch (IllegalAccessException e) {
|
|
throw new RuntimeException(e);
|
|
} catch (UnsupportedLookAndFeelException e) {
|
|
throw new RuntimeException(e);
|
|
}
|
|
//设置ICO图标
|
|
Image im;
|
|
ImageIcon ig = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\ico.jpg");//设置图标图片
|
|
im = ig.getImage();
|
|
setIconImage(im);
|
|
//设置背景图
|
|
ImageIcon icon = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\airplane2.png");//背景图
|
|
JLabel label = new JLabel(icon);//标签中加入图片
|
|
label.setBounds(0, 0, icon.getIconWidth(), icon.getIconHeight());//设置标签位置大小为图片大小
|
|
getLayeredPane().add(label, Integer.valueOf(Integer.MIN_VALUE));//标签添加到第二层面板
|
|
//获取顶层容器设为透明
|
|
JPanel Panel = (JPanel) getContentPane();
|
|
Panel.setOpaque(false);
|
|
getContentPane().setLayout(null);
|
|
|
|
Font font = new Font("楷体", Font.TYPE1_FONT, 20);
|
|
JLabel label1 = new JLabel("请输入以下信息:");
|
|
label1.setFont(font);
|
|
label1.setForeground(Color.red);
|
|
label1.setBounds(0, 20, 180, 30);
|
|
this.add(label1);
|
|
|
|
JLabel nameLab = new JLabel("姓 名:");
|
|
nameLab.setFont(font);
|
|
nameLab.setForeground(Color.LIGHT_GRAY);
|
|
JLabel idCardLab = new JLabel("身份证号:");
|
|
idCardLab.setFont(font);
|
|
|
|
nameTextField = new JTextField("不可编辑状态...等待修复", 27);
|
|
nameTextField.setForeground(Color.LIGHT_GRAY);
|
|
idCardTextField = new JTextField(27);
|
|
nameTextField.setEditable(false); //设置不可编辑
|
|
|
|
|
|
JPanel pan1 = new JPanel();
|
|
pan1.setBounds(50, 70, 100, 100);
|
|
pan1.setOpaque(false);
|
|
pan1.add(nameLab);
|
|
pan1.add(idCardLab);
|
|
this.add(pan1);
|
|
|
|
JPanel pan2 = new JPanel();
|
|
pan2.setBounds(155, 70, 200, 100);
|
|
pan2.setOpaque(false);
|
|
pan2.setLayout(new FlowLayout(0, 0, 7));
|
|
pan2.add(nameTextField);
|
|
pan2.add(idCardTextField);
|
|
this.add(pan2);
|
|
|
|
OKBtn = new JButton(okBtnIco);
|
|
OKBtn.setBounds(125, 185, 150, 30);
|
|
OKBtn.setFont(font);
|
|
this.add(OKBtn);
|
|
|
|
|
|
backBtn = new JButton("<<");
|
|
backBtn.setFont(font);
|
|
backBtn.setBounds(0, 0, 70, 30);
|
|
backBtn.setContentAreaFilled(false); //设置按钮透明
|
|
backBtn.setBorder(null); //取消边框
|
|
this.add(backBtn);
|
|
|
|
setBounds(600, 300, 400, 300);
|
|
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
|
setVisible(true);
|
|
setResizable(false);
|
|
setTitle(getTitle());
|
|
|
|
backBtn.addActionListener(this);
|
|
OKBtn.addActionListener(this);
|
|
}
|
|
|
|
public static void main(String[] args) {
|
|
new ShowOrder();
|
|
}
|
|
|
|
@Override
|
|
public void actionPerformed(ActionEvent e) {
|
|
if (e.getSource() == backBtn) {
|
|
this.dispose();
|
|
}
|
|
if (e.getSource() == OKBtn) {
|
|
|
|
}
|
|
}
|
|
}
|