最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

基于java實(shí)現(xiàn)停車場(chǎng)管理系統(tǒng)

 更新時(shí)間:2019年11月27日 14:33:01   作者:tatami1202  
這篇文章主要為大家詳細(xì)介紹了基于java實(shí)現(xiàn)停車場(chǎng)管理系統(tǒng),文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了java停車場(chǎng)管理系統(tǒng)的具體代碼,供大家參考,具體內(nèi)容如下

WorkFram.java

package com.parking;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.*;

/*
 * WotkFram.java
 *
 * Created on 2008年9月2日, 下午7:57
 */

/**
 *
 * @author cheng
 */
public class WorkFram extends JFrame {
 
 /**
 * 
 */
 private static final long serialVersionUID = 1L;

 /**
 * @param args the command line arguments
 */
 // 變量聲明 - 不進(jìn)行修改//GEN-BEGIN:variables
 
 private JButton jbtnEnter;
 
 private JButton jbtnRefrush;
 
 private JTextArea jtexInfor;
 
 public int m_areaCount; //停車區(qū)個(gè)數(shù)
 
 public int[] m_nos; //每個(gè)停車區(qū)的車位數(shù)
 
 public int[] m_apare; //每個(gè)停車區(qū)的空閑車位數(shù)
 
 // 變量聲明結(jié)束//GEN-END:variables
 //int m_areaCount;
 
 /** Creates new form WotkFram */
 
 public WorkFram(InitFrame frm) {
 
 this.m_areaCount = frm.m_Area.length;
 this.m_apare = new int[m_areaCount];
 this.m_nos = new int[m_areaCount];
 for(int i = 0; i < m_areaCount; i++){
  this.m_apare[i] = frm.m_Area[i];
  this.m_nos[i] = frm.m_Area[i];
 }
 
 initComponents();
 }
 
 /** 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() {
 
 jbtnEnter = new JButton();
 
 jbtnRefrush = new JButton();
 
 jtexInfor = new JTextArea("停車場(chǎng)初始化結(jié)果:\n" + getStopStatus());
 
 jtexInfor.setEnabled(false);
 
 setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
 
 setTitle("\u505c\u8f66\u573a\u6a21\u62df");
 
 jbtnEnter.setText("\u8fdb\u5165\u505c\u8f66\u573a");
 
 jbtnRefrush.setText("刷新");
 
 jbtnEnter.addActionListener(new ActionListener() {
  public void actionPerformed(ActionEvent evt) {
  jbtnEnterActionPerformed(evt);
  }
 });
 
 jbtnRefrush.addActionListener(new ActionListener() {
  public void actionPerformed(ActionEvent evt) {
  jbtnRefrushActionPerformed(evt);
  }
 });

 GroupLayout layout = new GroupLayout(getContentPane());
 
 getContentPane().setLayout(layout);
 
 layout.setHorizontalGroup(
  layout.createParallelGroup(GroupLayout.Alignment.LEADING)
  .addGroup(GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
  .addContainerGap(159, Short.MAX_VALUE)
  .addComponent(jtexInfor)
  .addComponent(jbtnRefrush)
  .addComponent(jbtnEnter)  
  .addGap(128, 128, 128))
 );
 
 layout.setVerticalGroup(
  layout.createParallelGroup(GroupLayout.Alignment.LEADING)
  .addGroup(GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
  .addContainerGap(204, Short.MAX_VALUE)
  .addComponent(jtexInfor)
  .addComponent(jbtnRefrush)
  .addComponent(jbtnEnter)
  .addGap(73, 73, 73))
 );
 
 pack();
 
 }// </editor-fold>//GEN-END:initComponents

 private void jbtnEnterActionPerformed(ActionEvent evt) {//GEN-FIRST:event_jbtnEnterActionPerformed
// TODO 將在此處添加您的處理代碼:
 Thread thr = new carThread(this);
 thr.run();
 }//GEN-LAST:event_jbtnEnterActionPerformed
 
 private void jbtnRefrushActionPerformed(ActionEvent evt) {//GEN-FIRST:event_jbtnEnterActionPerformed
// TODO 將在此處添加您的處理代碼:
 this.jtexInfor.setText("停車場(chǎng)當(dāng)前車區(qū)車位狀況統(tǒng)計(jì):\n" + getStopStatus()); 
 }//GEN-LAST:event_jbtnEnterActionPerformed
 
 public String getStopStatus() {
 String str = "";
 for (int i = 0; i < m_areaCount; i++) {
 if (m_apare[i] > 0) {
 str += " " + (i + 1) + " 區(qū)總車位:" + m_nos[i] + "\t當(dāng)前空閑車位 " + m_apare[i] + " 個(gè)\n";
 } else {
 str += " " + (i + 1) + " 區(qū)總車位:" + m_nos[i] + "\t當(dāng)前區(qū)無空閑車位\n";
 } 
 }
 return str;
 }
 
 public void setInfor(String infor) {
 this.jtexInfor.setText(infor);
 }
 
}

InitFrame.java

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 {
 
 // 變量聲明 - 不進(jìn)行修改
 //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;
 
 // 變量聲明結(jié)束//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, "您沒有初始化,無法執(zhí)行");
 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);
// setValue(frm);
 frm.setVisible(true);
 }// GEN-LAST:event_jbtnOKActionPerformed

 private void formWindowClosing(WindowEvent evt) {// GEN-FIRST:event_formWindowClosing
 // TODO 將在此處添加您的處理代碼:
 JOptionPane.showMessageDialog(null, "您沒有初始化,無法執(zhí)行");
 System.exit(-1);
 }// GEN-LAST:event_formWindowClosing

 private void jButton1ActionPerformed(ActionEvent evt) {// GEN-FIRST:event_jButton1ActionPerformed
 // TODO 將在此處添加您的處理代碼:
 boolean b = true;
 int n = ((Integer) mdl.getValue()).intValue() - 1;
 this.m_Area[n] = Integer.parseInt(this.jtxtCarCount.getText());
 for (int i = 0; i < m_Area.length; i++) {
 if (m_Area[i] <= 0) {
 b = false;
 
 }
 }
 try {
 mdl.setValue(mdl.getNextValue());
 this.jtxtCarCount.setText("");
 this.jtxtCarCount.setFocusable(true);
 } catch (Exception e) {
 }
 if (b)
 this.jbtnOK.setEnabled(true);
 }// GEN-LAST:event_jButton1ActionPerformed

 private void jbtnStopCountActionPerformed(ActionEvent evt) {// GEN-FIRST:event_jbtnStopCountActionPerformed
// TODO 將在此處添加您的處理代碼:
 String s = this.jtxtStopCount.getText();
 int i = Integer.parseInt(s);
 m_Area = new int[i];
 for (i = 0; i < m_Area.length; i++) {
 this.m_Area[i] = -1;// Integer.parseInt
 }
 this.jSpinnerStopArea.setEnabled(true);
 this.jtxtCarCount.setEnabled(true);
 mdl.setMinimum(new Integer(1));
 mdl.setMaximum(new Integer(m_Area.length));
 mdl.setValue(new Integer(1));
 }// GEN-LAST:event_jbtnStopCountActionPerformed
 
 /**
 * @param args the command line arguments
 */
 
 public static void main(String args[]) {
 java.awt.EventQueue.invokeLater(new Runnable() {
  public void run() {
  new InitFrame().setVisible(true);
  }
 }); 
 }
 
/* 
 public void setValue(WorkFram frm) {
 frm.m_areaCount = this.m_Area.length;
 frm.m_apare = new int[frm.m_areaCount];
 frm.m_nos = new int[frm.m_areaCount];
 for(int i = 0; i < frm.m_areaCount; i++){
  frm.m_apare[i] = this.m_Area[i];
  frm.m_nos[i] = this.m_Area[i];
 }
 }
*/
 
}

carThread.java

package com.parking;

/*
 * carThread.java
 *
 * Created on 2008年9月2日, 下午9:02
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

/**
 * 
 * @author cheng
 */
public class carThread extends Thread {

 private WorkFram frm;
 
 /** Creates a new instance of carThread */
 public carThread(WorkFram frm) {
 this.frm = frm;
 }
 
 public void run() {
 new carJFrame(frm).setVisible(true);
 }
 
}

carJFrame.java

package com.parking;

/*
 * carJFrame.java
 *
 * Created on 2008年9月2日, 下午9:01
 */

/**
 *
 * @author cheng
 */

import javax.swing.*;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

public class carJFrame extends JFrame {
 
 /**
 * 
 */
 private static final long serialVersionUID = 1L;

 /**
 * @param args the command line arguments
 */
 
 // 變量聲明 - 不進(jìn)行修改//GEN-BEGIN:variables
 
 private JButton jbtnEnterStop;
 
 private JButton jbtnLeftArea;
 
 private JButton jbtnLeftStop;
 
 private JButton jbtnLookUpArea;
 
 private JButton jbtnLookupPosition;
 
 private WorkFram mainFram;
 
 private int chooseArea;
 
 // 變量聲明結(jié)束//GEN-END:variables
 
 /** Creates new form carJFrame */
 
 public carJFrame(WorkFram frm) {
 initComponents();
 mainFram = frm;
 }
 
 /**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() {
 
 jbtnEnterStop = new JButton();
 jbtnLookUpArea = new JButton();
 jbtnLookupPosition = new JButton();
 jbtnLeftArea = new JButton();
 jbtnLeftStop = new JButton();

 setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
 
 setTitle("\u505c\u8f66\u573a\u64cd\u4f5c");
 
 jbtnEnterStop.setText("\u8fdb\u5165\u505c\u8f66\u573a");
 
 jbtnEnterStop.addActionListener(new ActionListener() {
  public void actionPerformed(ActionEvent evt) {
  jbtnEnterStopActionPerformed(evt);
  }
 });

 jbtnLookUpArea.setText("\u5bfb\u627e\u505c\u8f66\u533a");
 
 jbtnLookUpArea.addActionListener(new ActionListener() {
  public void actionPerformed(ActionEvent evt) {
  jbtnLookUpAreaActionPerformed(evt);
  }
 });

 jbtnLookupPosition.setText("\u5bfb\u627e\u505c\u8f66\u4f4d");
 
 jbtnLookupPosition.addActionListener(new ActionListener() {
  public void actionPerformed(ActionEvent evt) {
  jbtnLookupPositionActionPerformed(evt);
  }
 });

 jbtnLeftArea.setText("\u79bb\u5f00\u505c\u8f66\u533a");
 
 jbtnLeftArea.addActionListener(new ActionListener() {
  public void actionPerformed(ActionEvent evt) {
  jbtnLeftAreaActionPerformed(evt);
  }
 });

 jbtnLeftStop.setText("\u79bb\u5f00\u505c\u8f66\u573a");
 
 jbtnLeftStop.addActionListener(new ActionListener() {
  public void actionPerformed(ActionEvent evt) {
  jbtnLeftStopActionPerformed(evt);
  }
 });
 
 jbtnEnterStop.setEnabled(true);
 jbtnLookUpArea.setEnabled(false);
 jbtnLookupPosition.setEnabled(false);
 jbtnLeftArea.setEnabled(false);
 jbtnLeftStop.setEnabled(false);
 
 addWindowListener(new WindowAdapter() {
  public void windowClosing(WindowEvent evt) {
  formWindowClosing(evt);
  }
 });

 GroupLayout layout = new GroupLayout(getContentPane());
 
 getContentPane().setLayout(layout);
 
 layout.setHorizontalGroup(
  layout.createParallelGroup(GroupLayout.Alignment.LEADING)
  .addGroup(layout.createSequentialGroup()
  .addGap(102, 102, 102)
  .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
   .addComponent(jbtnLeftStop)
   .addComponent(jbtnLeftArea)
   .addComponent(jbtnLookupPosition)
   .addComponent(jbtnLookUpArea)
   .addComponent(jbtnEnterStop))
  .addContainerGap(205, Short.MAX_VALUE))
 );
 
 layout.setVerticalGroup(
  layout.createParallelGroup(GroupLayout.Alignment.LEADING)
  .addGroup(layout.createSequentialGroup()
  .addGap(56, 56, 56)
  .addComponent(jbtnEnterStop)
  .addGap(20, 20, 20)
  .addComponent(jbtnLookUpArea)
  .addGap(22, 22, 22)
  .addComponent(jbtnLookupPosition)
  .addGap(24, 24, 24)
  .addComponent(jbtnLeftArea)
  .addGap(19, 19, 19)
  .addComponent(jbtnLeftStop)
  .addContainerGap(44, Short.MAX_VALUE))
 );
 
 pack();
 
 }// </editor-fold>//GEN-END:initComponents

 private void jbtnLeftStopActionPerformed(ActionEvent evt) {//GEN-FIRST:event_jbtnLeftStopActionPerformed
// TODO 將在此處添加您的處理代碼:
 //離開停車場(chǎng),交存車卡
 
 JOptionPane.showMessageDialog(null, "停車卡收回,再見!");
/* jbtnEnterStop.setEnabled(true);
 jbtnLookUpArea.setEnabled(false);
 jbtnLookupPosition.setEnabled(false);
 jbtnLeftArea.setEnabled(false);
 jbtnLeftStop.setEnabled(false);
*/ 
 this.setVisible(false);
 this.removeNotify();
 
 }//GEN-LAST:event_jbtnLeftStopActionPerformed

 private void jbtnLeftAreaActionPerformed(ActionEvent evt) {//GEN-FIRST:event_jbtnLeftAreaActionPerformed
// TODO 將在此處添加您的處理代碼:
 //離開停車區(qū)
 
 int confirm = JOptionPane.showConfirmDialog(null, "確定要離開 " + chooseArea + " 號(hào)停車區(qū)?", "離開停車區(qū)", JOptionPane.YES_NO_OPTION);
 if (confirm == JOptionPane.YES_OPTION) { 
 mainFram.m_apare[chooseArea - 1]++;
// mainFram.setInfor(mainFram.getStopStatus());
 jbtnLeftArea.setEnabled(false);
 jbtnLookUpArea.setEnabled(true);
 jbtnLeftStop.setEnabled(true);
 } else if (confirm == JOptionPane.NO_OPTION) {
 JOptionPane.showMessageDialog(null, "您已放棄了離開該車區(qū)!");
 jbtnLookUpArea.setEnabled(true);
 } 
  
 }//GEN-LAST:event_jbtnLeftAreaActionPerformed

 private void jbtnLookupPositionActionPerformed(ActionEvent evt) {//GEN-FIRST:event_jbtnLookupPositionActionPerformed
// TODO 將在此處添加您的處理代碼:
 //進(jìn)入停車區(qū),尋找停車位

 int confirm = JOptionPane.showConfirmDialog(null, "您已經(jīng)選擇了" + chooseArea + " 號(hào)停車區(qū), " + "確定要進(jìn)入該停車區(qū)?", "進(jìn)行停車區(qū)尋找車位", JOptionPane.YES_NO_OPTION);
 if (confirm == JOptionPane.YES_OPTION) { 
 mainFram.m_apare[chooseArea - 1]--;
// mainFram.setInfor(mainFram.getStopStatus());
 jbtnLookUpArea.setEnabled(false);
 jbtnLookupPosition.setEnabled(false);
 jbtnLeftArea.setEnabled(true);
 jbtnLeftStop.setEnabled(false);
 } else if (confirm == JOptionPane.NO_OPTION) {
 JOptionPane.showMessageDialog(null, "您已放棄了進(jìn)入該車區(qū)!");
 jbtnLookUpArea.setEnabled(true);
 jbtnLookupPosition.setEnabled(false);
 } 
 
 }//GEN-LAST:event_jbtnLookupPositionActionPerformed

 private void jbtnLookUpAreaActionPerformed(ActionEvent evt) {//GEN-FIRST:event_jbtnLookUpAreaActionPerformed
// TODO 將在此處添加您的處理代碼:
 //進(jìn)入停車場(chǎng),尋找停車區(qū)
 
 ImageIcon icon = new ImageIcon("test.gif");
 int[] freeArea = getFreeArea();
 Object[] freeAreas = new Object[freeArea.length];
 for (int i = 0; i < freeArea.length; i++) {
 freeAreas[i] = freeArea[i];
 }
 
 Integer choose = (Integer)JOptionPane.showInputDialog(null, "當(dāng)前停車場(chǎng)狀況: \n" + mainFram.getStopStatus() + "\n請(qǐng)選擇一個(gè)空閑車區(qū):", "當(dāng)前可先空閑車區(qū): ", JOptionPane.PLAIN_MESSAGE, icon, freeAreas, (Integer)freeAreas[0]);
 
 if (choose != null) { 
 JOptionPane.showMessageDialog(null, "您選擇了進(jìn)入" + choose.intValue() + "車區(qū)");
 chooseArea = choose.intValue();
 jbtnLookUpArea.setEnabled(false);
 jbtnLookupPosition.setEnabled(true);
 } else {
 JOptionPane.showMessageDialog(null, "您沒有選擇車區(qū)!");
 } 
 
 }//GEN-LAST:event_jbtnLookUpAreaActionPerformed

 private void jbtnEnterStopActionPerformed(ActionEvent evt) {//GEN-FIRST:event_jbtnEnterStopActionPerformed
// TODO 將在此處添加您的處理代碼:
 //領(lǐng)卡,進(jìn)入停車場(chǎng)
 
 boolean isFull = true;
 for (int i = 0; i < mainFram.m_areaCount; i++) {
 if (mainFram.m_apare[i] > 0) {
 isFull = false;
 } 
 }
 
 if (isFull) {
 JOptionPane.showMessageDialog(null, "當(dāng)前車場(chǎng)無空閑車區(qū),請(qǐng)稍后再試!");
 } else {
 jbtnEnterStop.setEnabled(false);
  jbtnLookUpArea.setEnabled(true);
  jbtnLookupPosition.setEnabled(false);
  jbtnLeftArea.setEnabled(false);
  jbtnLeftStop.setEnabled(false);
  JOptionPane.showMessageDialog(null, "成功領(lǐng)取停車卡,請(qǐng)進(jìn)去車場(chǎng)尋找停車區(qū)位!");
 }
 
 }//GEN-LAST:event_jbtnEnterStopActionPerformed
 
 private void formWindowClosing(WindowEvent evt) {// GEN-FIRST:event_formWindowClosing
 // TODO 將在此處添加您的處理代碼:
 int confirm = JOptionPane.showConfirmDialog(null, "確定退出?", "退出停車區(qū)", JOptionPane.YES_NO_OPTION);
 if (confirm == JOptionPane.YES_OPTION) {
 if (chooseArea > 0) {
 mainFram.m_apare[chooseArea - 1]--; 
 }
 this.setVisible(false);
 this.removeNotify();
 } else {
 this.setVisible(true);
 }
 }// GEN-LAST:event_formWindowClosing
 
 public int[] getFreeArea() {
 int count = 0;
 for (int i = 0; i < mainFram.m_areaCount; i++) {
 if (mainFram.m_apare[i] > 0) {
 count++;
 } 
 }
 
 int[] freeArea = new int[count];
 
 for (int i = 0, j = 0; i < mainFram.m_areaCount; i++) {
 if (mainFram.m_apare[i] > 0) {
 freeArea[j++] = i + 1;
 } 
 }
  
 return freeArea;
 }
 
}

源碼下載:java停車場(chǎng)管理系統(tǒng)

更多學(xué)習(xí)資料請(qǐng)關(guān)注專題《管理系統(tǒng)開發(fā)》。

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • springcloud之Feign、ribbon如何設(shè)置超時(shí)時(shí)間和重試機(jī)制

    springcloud之Feign、ribbon如何設(shè)置超時(shí)時(shí)間和重試機(jī)制

    這篇文章主要介紹了springcloud之Feign、ribbon如何設(shè)置超時(shí)時(shí)間和重試機(jī)制,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2021-08-08
  • Mybatis Limit實(shí)現(xiàn)分頁(yè)功能

    Mybatis Limit實(shí)現(xiàn)分頁(yè)功能

    這篇文章主要介紹了Mybatis Limit實(shí)現(xiàn)分頁(yè)功能,使用Limit實(shí)現(xiàn)分頁(yè)可以減少數(shù)據(jù)的處理量,本文通過代碼講解的非常詳細(xì),需要的朋友可以參考下
    2021-04-04
  • Spring中的FactoryBean與BeanFactory詳細(xì)解析

    Spring中的FactoryBean與BeanFactory詳細(xì)解析

    這篇文章主要介紹了Spring中的FactoryBean與BeanFactory詳細(xì)解析,在Spring框架中,FactoryBean和BeanFactory是兩個(gè)關(guān)鍵的接口,用于創(chuàng)建和管理對(duì)象實(shí)例,它們?cè)赟pring的IoC(Inversion of Control,控制反轉(zhuǎn))容器中發(fā)揮著重要的作用,需要的朋友可以參考下
    2023-11-11
  • Spring Mybatis 分頁(yè)插件使用教程

    Spring Mybatis 分頁(yè)插件使用教程

    這篇文章主要介紹了Spring Mybatis分頁(yè)插件使用教程,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下
    2018-02-02
  • java多線程復(fù)制文件的實(shí)例代碼

    java多線程復(fù)制文件的實(shí)例代碼

    java多線程復(fù)制文件的實(shí)例代碼,需要的朋友可以參考一下
    2013-03-03
  • Java Object類詳解_動(dòng)力節(jié)點(diǎn)Java學(xué)院整理

    Java Object類詳解_動(dòng)力節(jié)點(diǎn)Java學(xué)院整理

    Java作為一個(gè)龐大的知識(shí)體系,涉及到的知識(shí)點(diǎn)繁多,本文將從Java中最基本的類java.lang.Object開始談起,對(duì)java object類相關(guān)知識(shí)感興趣的朋友一起學(xué)習(xí)吧
    2017-04-04
  • java文件操作報(bào)錯(cuò):java.io.FileNotFoundException(拒絕訪問)問題

    java文件操作報(bào)錯(cuò):java.io.FileNotFoundException(拒絕訪問)問題

    在進(jìn)行編程時(shí),經(jīng)常會(huì)遇到因疏忽小細(xì)節(jié)而導(dǎo)致的錯(cuò)誤,如忘記在路徑后添加文件名,本文通過一個(gè)具體的修改前后對(duì)比示例,解釋了錯(cuò)誤原因,并給出了解決方案,這類經(jīng)驗(yàn)分享對(duì)編程學(xué)習(xí)者具有參考價(jià)值
    2024-10-10
  • @Autowired注入為null問題原因分析

    @Autowired注入為null問題原因分析

    這篇文章主要介紹了@Autowired注入為null問題原因分析嗎,小編覺得挺不錯(cuò)的,對(duì)日后比較有幫助,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2018-11-11
  • SpringBoot監(jiān)控SQL運(yùn)行情況的流程步驟

    SpringBoot監(jiān)控SQL運(yùn)行情況的流程步驟

    Druid是Java語(yǔ)言中最好的數(shù)據(jù)庫(kù)連接池,雖然?HikariCP?的速度稍快,但是,Druid能夠提供強(qiáng)大的監(jiān)控和擴(kuò)展功能?,也是阿里巴巴的開源項(xiàng)目,本文給大家介紹了SpringBoot監(jiān)控SQL運(yùn)行情況的流程步驟,需要的朋友可以參考下
    2024-03-03
  • Java描述數(shù)據(jù)結(jié)構(gòu)學(xué)習(xí)之鏈表的增刪改查詳解

    Java描述數(shù)據(jù)結(jié)構(gòu)學(xué)習(xí)之鏈表的增刪改查詳解

    這篇文章主要給大家介紹了關(guān)于Java描述數(shù)據(jù)結(jié)構(gòu)學(xué)習(xí)之鏈表的增刪改查的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2018-05-05

最新評(píng)論

秦皇岛市| 蛟河市| 竹山县| 章丘市| 双流县| 柳林县| 邛崃市| 鸡东县| 郓城县| 冕宁县| 花莲县| 商水县| 扎赉特旗| 怀集县| 普兰店市| 宜都市| 崇左市| 德钦县| 安西县| 乳源| 义乌市| 余干县| 新野县| 黄平县| 南投市| 宁蒗| 巴彦淖尔市| 阳江市| 许昌市| 新密市| 漾濞| 东兴市| 繁昌县| 平陆县| 中江县| 鸡西市| 阿瓦提县| 石泉县| 雅江县| 德清县| 岐山县|