First commit
This commit is contained in:
@@ -0,0 +1,117 @@
|
||||
package xjdx.rjxy.airplane.view;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
public class RefundPage extends JFrame implements ActionListener {
|
||||
JTextField nameTextField, idCardTextField, flightNumberTextField;
|
||||
JButton backBtn, OKBtn;
|
||||
private Icon okBtnIco = new ImageIcon("E:\\JavaProjects_IDEA\\Airline Reservation System\\src\\xjdx\\rjxy\\airplane\\view\\images\\OK.png");
|
||||
|
||||
public RefundPage() {
|
||||
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);
|
||||
JLabel idCardLab = new JLabel("身份证号:");
|
||||
idCardLab.setFont(font);
|
||||
JLabel flightNumberLab = new JLabel("航 班 号:");
|
||||
flightNumberLab.setFont(font);
|
||||
|
||||
nameTextField = new JTextField(27);
|
||||
idCardTextField = new JTextField(27);
|
||||
flightNumberTextField = new JTextField(27);
|
||||
|
||||
JPanel pan1 = new JPanel();
|
||||
pan1.setBounds(50, 70, 100, 100);
|
||||
pan1.setOpaque(false);
|
||||
pan1.add(nameLab);
|
||||
pan1.add(idCardLab);
|
||||
pan1.add(flightNumberLab);
|
||||
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);
|
||||
pan2.add(flightNumberTextField);
|
||||
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 RefundPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (e.getSource() == backBtn) {
|
||||
this.dispose();
|
||||
}
|
||||
if (e.getSource() == OKBtn) {
|
||||
int res = JOptionPane.showConfirmDialog(null, "是否确认退票", "提示", JOptionPane.YES_OPTION);
|
||||
if (res == JOptionPane.YES_OPTION) {
|
||||
//确认退票后执行的操作
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user