資源簡介
Java 電梯模擬程序 很逼真的電梯模擬程序,模擬電梯上下樓,開門/關門,上下樓請求等,比較綜合的一個實例,對JAVA愛好者很有幫助。

代碼片段和文件信息
/*
?*?CurrentFloorPanel.java
?*
?*?Created?on?20061る5ら?と?1:08
?*/
package?marsping;
import?marsping.component.Elevator;
import?marsping.component.type.Floor;
/**
?*
?*?@author??MarsPing
?*/
public?class?CurrentFloorPanel?extends?javax.swing.JPanel?{
????FloorPanel[]?floorPanel?=?new?FloorPanel[Floor.values().length];
????
????/**?Creates?new?form?CurrentFloorPanel?*/
????public?CurrentFloorPanel()?{
????????initComponents();
????????Floor[]?floors?=?Floor.values();
????????for(int?i=0;?i ????????????floorPanel[i]?=?new?FloorPanel(floors[i]);
????????
????????for(FloorPanel?fp:floorPanel)
????????????add(fp?0);
????}
????
????public?void?setAllPanel(){
????????for(FloorPanel?fp:floorPanel)
????????????fp.resetPanel();
????????floorPanel[Elevator.getCurrentFloor().ordinal()].setPanel();
????}
????
????/**?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.
?????*/
????//?//GEN-BEGIN:initComponents
????private?void?initComponents()?{
????????setBackground(new?java.awt.Color(102?102?102));
????????setBorder(javax.swing.BorderFactory.createLineBorder(new?java.awt.Color(204?204?255)));
????????setPreferredSize(new?java.awt.Dimension(60?365));
????}//? //GEN-END:initComponents
????
????
????//?Variables?declaration?-?do?not?modify//GEN-BEGIN:variables
????//?End?of?variables?declaration//GEN-END:variables
????
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
-----------?---------??----------?-----??----
???????????????629829????????????????????143
評論
共有 條評論