91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 40KB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2021-06-02
  • 語言: Java
  • 標簽: javafx??java??

資源簡介

本資源使用javafx實現模擬電梯升降演示,界面的話還可以,但是在算法上還需要優化。

資源截圖

代碼片段和文件信息

package?Test;

import?javafx.scene.control.Button;
import?javax.swing.JOptionPane;
import?javax.swing.UIManager;
import?javax.swing.UnsupportedLookAndFeelException;

public?class?Alevator1?{
private?boolean?door=true;//電梯門狀態
private?int?floor=1;//電梯所在樓層
private?float?weight=0;
private?int?zt=0;//電梯狀態(1上,2下,0靜止)
Thread?thread0=new?Thread();

final?int?maxweight=800;//電梯最大承重量
final?int?maxfloor=20;//電梯所達最高樓層
final?int?minfloor=1;//電梯所在最低樓層
final?int?maxmember=10;//電梯所載最多人數

int[]?ava14?=?{1234567891011121314151617181920};

public?Alevator1(){
floor=1;
door=true;
weight=0;
zt=0;
}
//電梯開門
public?void?opendoor(Button?b[]){
Thread?thread=new?Thread(){
@Override
public?void?run(){
door=false;
b[floor-1].setstyle(“-fx-background-color:?green“);
try{
Thread.sleep(2500);?
}?catch?(InterruptedException?e1)?{
e1.printStackTrace();}?
closeDoor(b);????
}
};
thread.start();
}
//電梯關門
public?void?closeDoor(Button?b[])?{
Thread?thread=new?Thread(){
@Override
public?void?run(){
try?{
????????UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
????}?catch?(ClassNotFoundException?|?InstantiationException?|?IllegalAccessException
????????????|?UnsupportedLookAndFeelException?e)?{
????????e.printStackTrace();
????}
weight?=?(int)(Math.random()*1000); //電梯人數隨機設定
if(weight<=maxweight)
{
door=true;
b[floor-1].setstyle(“-fx-background-color:?red“);
}
else?{
JOptionPane.showMessageDialog(null?“當前是一號電梯“+“\n電梯已超重!“);?
opendoor(b);
}
}
};
thread.start();
}
//電梯上行
public?void?goUp(Button?d[]){

try{
Thread.sleep(1000);?
}?catch?(InterruptedException?e1)?{
e1.printStackTrace();}?
floor++;
????d[floor-1].setstyle(“-fx-background-color:?red“);
????d[floor-2].setstyle(“-fx-background-color:?GRAY“);
????
}
//電梯下降
public?void?goDown(Button?d[]){
try{
Thread.sleep(1000);????
}?catch?(InterruptedException?e)?{
e.printStackTrace();
}
floor--;
d[floor-1].setstyle(“-fx-background-color:?red“);
????d[floor].setstyle(“-fx-background-color:?GRAY“);
}

public?void?running(Button?ckint?goalButton?b[])?{
try?{
????????UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
????}?catch?(ClassNotFoundException?|?InstantiationException?|?IllegalAccessException
????????????|?UnsupportedLookAndFeelException?e)?{
????????e.printStackTrace();
????}
thread0=new?Thread(){
@Override
public?void?run(){
while(floor!=goal)
{
if(floor {
goUp(b);
zt=1;
}
else
{
goDown(b);
zt=2;
}
}
zt=0;
ck.setstyle(“-fx-background-color:?lightblue“);
try{
Thread.sleep(1000);????
}?catch?(InterruptedException?e)?{
e.printStackTrace();

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-08-14?20:37??模擬電梯運行\
?????文件?????????409??2019-01-29?11:37??模擬電梯運行\.classpath
?????文件?????????384??2018-03-24?13:54??模擬電梯運行\.project
?????目錄???????????0??2018-08-14?20:37??模擬電梯運行\.settings\
?????文件?????????592??2018-03-24?13:54??模擬電梯運行\.settings\org.eclipse.jdt.core.prefs
?????目錄???????????0??2018-08-14?20:37??模擬電梯運行\bin\
?????目錄???????????0??2018-08-14?20:37??模擬電梯運行\bin\Test\
?????文件????????1112??2018-03-24?13:54??模擬電梯運行\bin\Test\Alevator1$1.class
?????文件????????1714??2018-03-24?13:54??模擬電梯運行\bin\Test\Alevator1$2.class
?????文件????????1863??2018-03-24?13:54??模擬電梯運行\bin\Test\Alevator1$3.class
?????文件????????3929??2018-03-24?13:54??模擬電梯運行\bin\Test\Alevator1.class
?????文件????????1112??2018-03-24?13:54??模擬電梯運行\bin\Test\Alevator2$1.class
?????文件????????1714??2018-03-24?13:54??模擬電梯運行\bin\Test\Alevator2$2.class
?????文件????????1863??2018-03-24?13:54??模擬電梯運行\bin\Test\Alevator2$3.class
?????文件????????3828??2018-03-24?13:54??模擬電梯運行\bin\Test\Alevator2.class
?????文件????????1112??2018-03-24?13:54??模擬電梯運行\bin\Test\Alevator3$1.class
?????文件????????1714??2018-03-24?13:54??模擬電梯運行\bin\Test\Alevator3$2.class
?????文件????????1863??2018-03-24?13:54??模擬電梯運行\bin\Test\Alevator3$3.class
?????文件????????3860??2018-03-24?13:54??模擬電梯運行\bin\Test\Alevator3.class
?????文件????????1112??2018-03-24?13:54??模擬電梯運行\bin\Test\Alevator4$1.class
?????文件????????1714??2018-03-24?13:54??模擬電梯運行\bin\Test\Alevator4$2.class
?????文件????????1863??2018-03-24?13:54??模擬電梯運行\bin\Test\Alevator4$3.class
?????文件????????3918??2018-03-24?13:54??模擬電梯運行\bin\Test\Alevator4.class
?????文件????????7066??2018-03-24?13:54??模擬電梯運行\bin\Test\Dispatch.class
?????文件???????11704??2018-03-24?13:54??模擬電梯運行\bin\Test\Main.class
?????目錄???????????0??2018-08-14?20:37??模擬電梯運行\src\
?????目錄???????????0??2018-08-14?20:37??模擬電梯運行\src\Test\
?????文件????????3699??2018-03-24?13:54??模擬電梯運行\src\Test\Alevator1.java
?????文件????????3646??2018-03-24?13:54??模擬電梯運行\src\Test\Alevator2.java
?????文件????????3651??2018-03-24?13:54??模擬電梯運行\src\Test\Alevator3.java
?????文件????????3657??2018-03-24?13:54??模擬電梯運行\src\Test\Alevator4.java
............此處省略2個文件信息

評論

共有 條評論