package USC.Dialog;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.sql.SQLException;
import javax.swing.*;
import USC.Util.FrameJdbc;
import USC.Util.ImageLoad;
import USC.Util.JDBC;
public class TicketBuyDialog extends JDialog{
Image i_up;
JButton jb_buy=new JButton("购买");
JButton jb_update=new JButton("刷新");
String Tid;
String Yseat,Rseat,Ybed,Rbed,Sticket;
Font f1,f2;
int x,y;
MyPanel mp;
public TicketBuyDialog(Dialog dialog,boolean model,String Tid,int x,int y) throws Exception{
super(dialog, model);
this.Tid=Tid;
setLayout(null);
i_up=ImageLoad.ImageLoad("Image\\DialogImage\\Tickbuy.png");
f1=new Font("宋体", Font.BOLD, 25);
f2=new Font("宋体", Font.PLAIN, 15);
addComponent();
setTicketNumber();
setBounds(x, y, i_up.getWidth(null), 400);
setResizable(false);
setVisible(true);
}
public void init(String Tid){
this.Tid=Tid;
mp.repaint();
}
private void addComponent(){
mp=new MyPanel();
add(mp);
}
public void update(){
jb_update.doClick();
}
public void init(){
mp.init();
}
class MyPanel extends JPanel{
JTextField jtf1,jtf2,jtf3,jtf4,jtf5;
boolean canbuy=true;
Color back=new Color(255, 217, 217);
public void init(){
jtf1.setText("0");jtf2.setText("0");jtf3.setText("0");jtf4.setText("0");
jtf5.setText("0");
}
public MyPanel(){
super();
this.setLayout(null);
this.setBounds(0, 0, i_up.getWidth(null), 380);
jtf1=new JTextField("0");jtf2=new JTextField("0");jtf3=new JTextField("0");
jtf4=new JTextField("0");jtf5=new JTextField("0");
jtf1.setForeground(Color.LIGHT_GRAY);
jtf2.setForeground(Color.LIGHT_GRAY);
jtf3.setForeground(Color.LIGHT_GRAY);
jtf4.setForeground(Color.LIGHT_GRAY);
jtf5.setForeground(Color.LIGHT_GRAY);
jtf1.addFocusListener(new FocusListener() {
public void focusLost(FocusEvent arg0) {
if(jtf1.getText().trim().isEmpty()){
jtf1.setText("0");
}
jtf1.setForeground(Color.LIGHT_GRAY);
if(Integer.valueOf(jtf1.getText().trim())<0){
canbuy=false;
JOptionPane.showMessageDialog(null, "您输入的数量有误", "提示", JOptionPane.INFORMATION_MESSAGE);
jtf1.setText("0");
return;
}
if(Yseat.equals("无")&&!jtf1.getText().trim().equals("0")){
canbuy=false;
JOptionPane.showMessageDialog(null, "对不起票已卖完", "提示", JOptionPane.INFORMATION_MESSAGE);
jtf1.setText("0");
return;
}
if(Yseat.equals("无"))Yseat="0";
if(Integer.valueOf(Yseat)<Integer.valueOf(jtf1.getText().trim())){
canbuy=false;
JOptionPane.showMessageDialog(null, "对不起没有足够车票", "提示", JOptionPane.INFORMATION_MESSAGE);
jtf1.setText("0");
return;
}
canbuy=true;
}
public void focusGained(FocusEvent arg0) {
jtf1.setForeground(Color.BLACK);
jtf1.selectAll();
}
});
jtf2.addFocusListener(new FocusListener() {
public void focusLost(FocusEvent arg0) {
if(jtf2.getText().trim().isEmpty()){
jtf2.setText("0");
}
jtf2.setForeground(Color.LIGHT_GRAY);
if(Integer.valueOf(jtf2.getText().trim())<0){
canbuy=false;
JOptionPane.showMessageDialog(null, "您输入的数量有误", "提示", JOptionPane.INFORMATION_MESSAGE);
jtf2.setText("0");
return;
}
if(Rseat.equals("无")&&!jtf2.getText().trim().equals("0")){
canbuy=false;
JOptionPane.showMessageDialog(null, "对不起票已卖完", "提示", JOptionPane.INFORMATION_MESSAGE);
jtf2.setText("0");
return;
}
if(Rseat.equals("无"))Rseat="0";
if(Integer.valueOf(Rseat)<Integer.valueOf(jtf2.getText().trim())){
canbuy=false;
JOptionPane.showMessageDialog(null, "对不起没有足够车票", "提示", JOptionPane.INFORMATION_MESSAGE);
jtf2.setText("0");
return;
}
canbuy=true;
}
public void focusGained(FocusEvent arg0) {
jtf2.setForeground(Color.BLACK);
jtf2.selectAll();
}
});
jtf3.addFocusListener(new FocusListener() {
public void focusLost(FocusEvent arg0) {
if(jtf3.getText().trim().isEmpty()){
jtf3.setText("0");
}
jtf3.setForeground(Color.LIGHT_GRAY);
if(Integer.valueOf(jtf3.getText().trim())<0){
canbuy=false;
JOptionPane.showMessageDialog(null, "您输入的数量有误", "提示", JOptionPane.INFORMATION_MESSAGE);
jtf3.setText("0");
return;
}
if(Ybed.equals("无")&&!jtf3.getText().trim().equals("0")){
canbuy=false;
JOptionPane.showMessageDialog(null, "对不起票已卖完", "提示", JOptionPane.INFORMATION_MESSAGE);
jtf3.setText("0");
return;
}
if(Ybed.equals("无"))Ybed="0";
if(Integer.valueOf(Ybed)<Integer.valueOf(jtf3.getText().trim())){
canbuy=false;
JOptionPane.showMessageDialog(null, "对不起没有足够车票", "提示", JOptionPane.INFORMATION_MESSAGE);
jtf3.setText("0");
return;
}
canbuy=true;
}
public void focusGained(FocusEvent arg0) {
jtf3.setForeground(Color.BLACK);
jtf3.selectAll();
}
});
jtf4.addFocusListener(new FocusListener() {
public void focusLost(FocusEvent arg0) {
if(jtf4.getText().trim().isEmpty()){
jtf4.setText("0");
}
jtf4.setForeground(Color.LIGHT_GRAY);
if(Integer.valueOf(jtf4.getText().trim())<0){
canbuy=false;
JOptionPane.showMessageDialog(null, "您输入的数量有误", "提示", JOptionPane.INFORMATION_MESSAGE);
jtf4.setText("0");
return;
}
if(Rbed.equals("无")&&!jtf4.getText().trim().equals("0")){
canbuy=false;
JOptionPane.showMessageDialog(null, "对不起票已卖完", "提示", JOptionPane.INFORMATION_MESSAGE);
jtf4.setText("0");
return;
}
if(Rbed.equals("无"))Rbed="0";
if(Integer.valueOf(Rbed)<Integer.valueOf(jtf4.getText().trim())){
canbuy=false;
JOptionPane.showMessageDialog(null, "对不起没有足够车票", "提示", JOptionPane.INFORMATION_MESSAGE);
jtf4.setText("0");
return;
}
canbuy=true;
}
public void focusGained(FocusEvent arg0) {
jtf4.setForeground(Color.BLACK);
jtf4.selectAll();
}
});
jtf5.addFocusListener(new FocusListener() {
public void focusLost(FocusEvent arg0) {
if(jtf5.getText().trim().isEmpty()){
jtf5.setText("0");
}
jtf5.setForeground(Color.LIGHT_GRAY);
if(Integer.valueOf(jtf5.getText().trim())<0){
canbuy=false;
JOptionPane.showMessageDialog(null, "您输入的数量有误", "提示", JOptionPane.INFORMATION_MESSAGE);
jtf5.setText("0");
return;
}
if(Sticket.equals("无")&&!jtf5.getText().trim().equals("0")){
canbuy=false;
JOptionPane.showMessageDialog(null, "对不起票已卖完", "提示", JOptionPane.INFORMATION_MESSAGE);
jtf5.setText("0");
return;
}
if(Sticket.equals("无"))Sticket="0";
if(Integer.valueOf(Sticket)<Integer.valueOf(jtf5.getText().trim())){
canbuy=false;
JOptionPane.showMessageDialog(null, "对不起没有足够车票", "提示", JOptionPane.INFORMATION_MESSAGE);
jtf5.setText("0");
return;
}
canbuy=true;
}
public void focusGained(FocusEvent arg0) {
jtf5.setForeground(Color.BLACK);
jtf5.selectAll();
}
});
this.addComponent();
this.addActionlistener();
}
private void addComponent(){
jtf1.setBounds(290, 110, 50, 20);
jtf2.setBounds(290, 135, 50, 20);
jtf3.setBounds(290, 165, 50, 20);
jtf4.setBounds(290, 195, 50, 20);
jtf5.setBounds(290, 225, 50, 20);
jb_buy.setBounds(320, 300, 80, 25);
jb_update.setBounds(220, 300, 80, 25);
this.add(jb_buy);this.add(jb_update);
this.add(jtf1);this.a
没有合适的资源?快使用搜索试试~ 我知道了~
火车站售票管理系统 JavaSe
共134个文件
class:78个
java:25个
png:24个
4星 · 超过85%的资源 需积分: 15 81 下载量 87 浏览量
2011-06-21
01:25:53
上传
评论 2
收藏 719KB RAR 举报
温馨提示
Java写的火车站售票管理系统 可以应付软工作业 2000行 功能实现较好 未外加sql语句 勤快点儿自己看着写
资源推荐
资源详情
资源评论
收起资源包目录
火车站售票管理系统 JavaSe (134个子文件)
Login.class 10KB
TrainCheckPanel.class 5KB
TicketBuyDialog$MyPanel.class 4KB
TicketBuyDialog$MyPanel.class 4KB
FrameJdbc.class 3KB
JMenuBarManager.class 3KB
TicketBuyDialog$MyPanel$6.class 3KB
BuyTicketDialog.class 3KB
TicketBuyDialog$MyPanel$6.class 3KB
JToolBarManager.class 3KB
BuyTicketDialog.class 3KB
TicketBuyDialog.class 3KB
UserMessage$4.class 3KB
UserMessage.class 3KB
TicketBuyDialog.class 3KB
BuyAndCancelPanel.class 3KB
LoginAddDialog$MyPanel.class 3KB
LoginAddDialog$MyPanel$1.class 3KB
LoginAddDialog.class 2KB
MainFrame.class 2KB
TicketBuyDialog$MyPanel$5.class 2KB
TicketBuyDialog$MyPanel$2.class 2KB
TicketBuyDialog$MyPanel$1.class 2KB
TicketBuyDialog$MyPanel$3.class 2KB
TicketBuyDialog$MyPanel$4.class 2KB
TrainCheckPanel$5.class 2KB
UserMessageTableModel.class 2KB
TicketBuyDialog$MyPanel$5.class 2KB
TicketBuyDialog$MyPanel$2.class 2KB
TicketBuyDialog$MyPanel$1.class 2KB
TicketBuyDialog$MyPanel$3.class 2KB
TicketBuyDialog$MyPanel$4.class 2KB
BuyAndCancelPanel$3.class 2KB
TrainCheckPanel$2.class 2KB
JTabbedPaneManager.class 2KB
TrainMessageTable.class 2KB
LoginJdbc.class 2KB
BuyTicketDialog$1.class 2KB
TrainCheckModel.class 2KB
BuyTicketDialog$1.class 2KB
UserMessage$3.class 2KB
TrainChangePanel.class 2KB
LoginingTest.class 2KB
LoginingTest$myPanel.class 1KB
BuyTicketDialog$MyPanel.class 1KB
BuyTicketDialog$MyPanel.class 1KB
Logining$myPanel.class 1KB
JDBC.class 1KB
BuyAndCancelPanel$1.class 1KB
BuyAndCancelPanel$2.class 1KB
TrainCheckPanel$1.class 1KB
TrainCheckPanel$4.class 1KB
TrainCheckPanel$3.class 1KB
Logining.class 1KB
UserMessage$1.class 1KB
UserMessage$2.class 1KB
Login$1.class 1KB
TicketBuyDialog$MyPanel$7.class 1KB
TicketBuyDialog$MyPanel$7.class 1KB
Login$2.class 1KB
JMenuBarManager$2.class 1KB
ImageLoad.class 1KB
JMenuBarManager$1.class 972B
Login$PreLoad.class 913B
LoginAddDialog$MyPanel$2.class 912B
WholeModel.class 905B
JMenuBarManager$6.class 853B
JMenuBarManager$7.class 853B
JMenuBarManager$3.class 853B
JMenuBarManager$4.class 852B
JToolBarManager$2.class 851B
JToolBarManager$5.class 851B
JToolBarManager$4.class 851B
JMenuBarManager$5.class 851B
JToolBarManager$3.class 850B
JToolBarManager$1.class 849B
Login$3.class 739B
MyThread.class 534B
.classpath 636B
Logining.gif 90KB
TicketBuyDialog.java 12KB
Login.java 11KB
TicketBuyDialog.java 11KB
TrainCheckPanel.java 7KB
UserMessage.java 6KB
FrameJdbc.java 4KB
LoginAddDialog.java 4KB
BuyAndCancelPanel.java 4KB
JMenuBarManager.java 4KB
JToolBarManager.java 4KB
BuyTicketDialog.java 3KB
BuyTicketDialog.java 3KB
UserMessageTableModel.java 2KB
LoginJdbc.java 1KB
MainFrame.java 1KB
TrainMessageTable.java 1KB
JTabbedPaneManager.java 1KB
LoginingTest.java 1KB
TrainCheckModel.java 1KB
Logining.java 1KB
共 134 条
- 1
- 2
资源评论
- u0102925512014-03-16很好,帮助很大,要是有数据库脚本就更好了
- rzx1989120715102014-03-10能不能给个数据库?
- qq_380288862017-03-23看看学学,自己也编一个
- lt2boyowf2013-05-20很好,帮助很大,要是有数据库脚本就更好了
- huzhancheng2012-07-12没有数据库。
nonoocean1
- 粉丝: 1
- 资源: 7
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功