import java.awt.*;
import javax.swing.*;
public class TickeWindow extends JFrame
{
JComboBox comBox,comBox1,comBox2; //下拉
JButton button_check,sale1,sale2,exit; //按钮
JTextArea area; //文本区
JTextField text1,text2; //文本框
JLabel title;
public TickeWindow()
{
init();
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
void init()
{
setLayout(new FlowLayout());
title = new JLabel("网上售票系统");
title.setSize(20,20);
add(title);
add(new JLabel("选择路线"));
comBox = new JComboBox();
comBox.addItem("和平->广州");
comBox.addItem("广州->江门");
comBox.addItem("江门->广州");
comBox.addItem("广州->和平");
add(comBox);
button_check = new JButton("查询");
add(button_check);
area = new JTextArea(5,4);
add(new JScrollPane(area));
add(new JLabel("班次"));
comBox1 = new JComboBox();
comBox1.addItem("2001");
comBox1.addItem("2002");
comBox1.addItem("2003");
comBox1.addItem("2004");
add(new JLabel("票数"));
text1 = new JTextField(2);
add(text1);
sale1 = new JButton("1号窗购买");
add(sale1);
add(new JLabel("班次"));
comBox2 = new JComboBox();
comBox2.addItem("2001");
comBox2.addItem("2002");
comBox2.addItem("2003");
comBox2.addItem("2004");
add(new JLabel("票数"));
text2 = new JTextField(2);
add(text2);
sale2 = new JButton("2号窗购买");
add(sale2);
exit = new JButton("退出");
add(exit);
}
}
这段代码提示不安全操作