package com.parking;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.*;
/*
* InitFrame.java
*
* Created on 2008年9月2日, 下午7:36
*/
/**
*
* @author cheng
*/
public class InitFrame extends JFrame {
// 变量声明 - 不进行修改
//GEN-BEGIN:variables
/**
*
*/
private static final long serialVersionUID = 1L;
private JButton jButton1;
private JLabel jLabel1;
private JLabel jLabel2;
private JLabel jLabel3;
private JSpinner jSpinnerStopArea;
private JButton jbtnCancel;
private JButton jbtnOK;
public JButton jbtnStopCount;
private JTextField jtxtCarCount;
private JTextField jtxtStopCount;
public int m_Area[];
SpinnerNumberModel mdl;
// 变量声明结束//GEN-END:variables
/** Creates new form InitFrame */
public InitFrame() {
initComponents();
mdl = new SpinnerNumberModel();
this.jSpinnerStopArea.setModel(mdl);
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc=" 生成的代码 ">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new JLabel();
jtxtStopCount = new JTextField();
jbtnStopCount = new JButton();
jLabel2 = new JLabel();
jSpinnerStopArea = new JSpinner();
jLabel3 = new JLabel();
jtxtCarCount = new JTextField();
jButton1 = new JButton();
jbtnOK = new JButton();
jbtnCancel = new JButton();
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
setTitle("\u505c\u8f66\u573a\u521d\u59cb\u5316");
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent evt) {
formWindowClosing(evt);
}
});
jLabel1.setText("\u505c\u8f66\u533a\u57df\u4e2a\u6570\uff1a");
jbtnStopCount.setText("\u8f93\u5165\u505c\u533a\u4e2a\u6570");
jbtnStopCount.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
jbtnStopCountActionPerformed(evt);
}
});
jLabel2.setText("\u505c\u8f66\u533a\u53f7\uff1a");
jSpinnerStopArea.setEnabled(false);
jLabel3.setText("\u505c\u8f66\u4f4d\u4e2a\u6570\uff1a");
jtxtCarCount.setEnabled(false);
jButton1.setText("\u8f93\u5165\u505c\u533a\u8f66\u4f4d\u4e2a\u6570");
jButton1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jbtnOK.setText("\u786e\u5b9a");
jbtnOK.setEnabled(false);
jbtnOK.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
jbtnOKActionPerformed(evt);
}
});
jbtnCancel.setText("\u53d6\u6d88");
jbtnCancel.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
jbtnCancelActionPerformed(evt);
}
});
GroupLayout layout = new GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel2)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSpinnerStopArea, GroupLayout.PREFERRED_SIZE, 37, GroupLayout.PREFERRED_SIZE)
.addGap(14, 14, 14)
.addComponent(jLabel3, GroupLayout.PREFERRED_SIZE, 81, GroupLayout.PREFERRED_SIZE)
.addGap(13, 13, 13)
.addComponent(jtxtCarCount, GroupLayout.PREFERRED_SIZE, 117, GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1)
.addGap(24, 24, 24)
.addComponent(jtxtStopCount, GroupLayout.PREFERRED_SIZE, 99, GroupLayout.PREFERRED_SIZE)
.addGap(25, 25, 25)
.addComponent(jbtnStopCount))))
.addGroup(layout.createSequentialGroup()
.addGap(29, 29, 29)
.addComponent(jButton1, GroupLayout.DEFAULT_SIZE, 137, Short.MAX_VALUE)
.addGap(22, 22, 22)
.addComponent(jbtnOK, GroupLayout.DEFAULT_SIZE, 65, Short.MAX_VALUE)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jbtnCancel, GroupLayout.PREFERRED_SIZE, 66, GroupLayout.PREFERRED_SIZE)
.addGap(23, 23, 23)))
.addGap(51, 51, 51))
);
layout.setVerticalGroup(
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(30, 30, 30)
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jtxtStopCount, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(jbtnStopCount))
.addGap(27, 27, 27)
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING)
.addComponent(jLabel2)
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(jSpinnerStopArea, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)
.addComponent(jtxtCarCount, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
.addGap(76, 76, 76)
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(jButton1)
.addComponent(jbtnOK)
.addComponent(jbtnCancel))
.addContainerGap(100, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jbtnCancelActionPerformed(ActionEvent evt) {// GEN-FIRST:event_jbtnCancelActionPerformed
// TODO 将在此处添加您的处理代码:
JOptionPane.showMessageDialog(null, "您没有初始化,无法执行");
System.exit(-1);
}// GEN-LAST:event_jbtnCancelActionPerformed
private void jbtnOKActionPerformed(ActionEvent evt) {// GEN-FIRST:event_jbtnOKActionPerformed
// TODO 将在此处添加您的处理代码:
this.setVisible(false);
this.removeNotify();
WorkFram frm = new WorkFram(this)
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
用java写的停车场管理系统,只要运用swing 初始化停车场(确定停车区个数n,每个停车区的停车位,且初始时,停车场为空),说明:使用一个共享数组(临界资源)存储每个停车区中空闲停车位的个数,每一个停车区使用一个共享缓冲区可容纳一辆车,停车场公共通道允许通过两辆车通过。 停车场入口检查是否有空闲停位,如果有发放相关停车区的停车卡,允许停车。如果不存在空闲车位,等待到有空闲车位止。注,入口处应尽量发放不同停车区的停车卡,以获得更高的效率。停车场过 道允许两辆车同时通过。 停车场出口,回收停车卡,并修改相关停车区空闲车位数。注:同一时刻只能有一个车出停车场。 每一个停车区,有一个待车位,供进入停车区车辆进入停车区。停车区只能有一辆车进或出。 每辆车每进入下一环节皆应停留一定时间。每一个用户建立一个窗口,于窗口中显示当前将态。将状态转换可由人工确定亦可自动完成,但进入下状态时需要停留学生一定的时间,以保证多个用户“并行”工作。 本框架由四个类组成,这四个类分别是:InitFrame、WotkFram、carJFrame及carThread,由InitFrame启动。类InitFrame提供停车场初始化功能,完成初始任务后启动类WotkFram界面,执行停车场模拟程序,点击命令按扭“进入停车场”,建立一个线程(线程类名为carThread),线程建立一个carJFrame窗口(车辆进入、离开停车场操作程序)模拟车辆进入或离开停车场。
资源推荐
资源详情
资源评论
收起资源包目录
停车场管理系统.zip (25个子文件)
parkingGarage
.project 520B
src
com
parking
carThread.java 483B
InitFrame.java 10KB
carJFrame.java 10KB
WorkFram.java 5KB
.settings
org.eclipse.jdt.core.prefs 629B
.classpath 232B
bin
com
parking
carJFrame$4.class 762B
InitFrame$1.class 735B
InitFrame$3.class 762B
InitFrame.class 7KB
carJFrame$5.class 762B
carJFrame$6.class 735B
WorkFram$2.class 755B
carJFrame$2.class 762B
WorkFram.class 4KB
carJFrame.class 7KB
InitFrame$2.class 762B
InitFrame$5.class 762B
InitFrame$4.class 762B
InitFrame$6.class 546B
carJFrame$1.class 762B
WorkFram$1.class 755B
carThread.class 525B
carJFrame$3.class 762B
共 25 条
- 1
资源评论
林先森cC
- 粉丝: 19
- 资源: 64
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功