• 전문가 요청 쿠폰 이벤트
*희*
Bronze개인
팔로워0 팔로우
소개
등록된 소개글이 없습니다.
전문분야 등록된 전문분야가 없습니다.
판매자 정보
학교정보
입력된 정보가 없습니다.
직장정보
입력된 정보가 없습니다.
자격증
  • 입력된 정보가 없습니다.
판매지수
전체자료 1
검색어 입력폼
  • [자바 스크립트] 자바엘리베이터소스
    // Program name : ElevatorAction.java - 엘리베이터 작동 시뮬레이션 -// Author : Shik Kim// Date : 2001. 11. 16// Up Date : 2001. 11. 16import java.io.*;import java.util.*;import java.awt.*;import java.awt.event.*;import java.awt.Color;import javax.swing.*;// 난수를 발생시켜 주는 클래스 - 요구될 층과 가야할 층을 결정 -class RandomGeneration{int floor;public RandomGeneration(){floor = 0;}// 1 ~ 10 까지의 난수를 발생시킨다.public int randomize(){floor = ((int)(Math.random()*10%10)+1);return floor;}}// 엘리베이터 모델을 만들어주는 클래스class Elevator_Initialize extends JFrame{JLabel label;JSlider slider;TextField ment;JButton UF_1, UF_2, UF_3, UF_4, UF_5, UF_6, UF_7, UF_8, UF_9, UF_10;JButton DF_1, DF_2, DF_3, DF_4, DF_5, DF_6, DF_7, DF_8, DF_9, DF_10;JToggleButton Start, Stop;int status;// 엘리베어터 Constructorpublic Elevator_Initialize(){super("Elevator ..."); // 프레임 상단에 Title을 출력BorderLayout border = new BorderLayout(); // 전체 레이아웃을 설정getContentPane().setLayout(border);Icon logo = new ImageIcon("disk.gif"); // 라벨에 이미지를 출력label = new JLabel("Elevator Siownfloor.add(DF_2);downfloor.add(DF_1);// up버튼을 초기화JPanel upfloor = new JPanel();upfloor.setLayout(new GridLayout(10,1,1,1));upfloor.setBackground(Color.darkGray);UF_1 = new JButton("up 1F");UF_2 = new JButton("up 2F");UF_3 = new JButton("up 3F");UF_4 = new JButton("up 4F");UF_5 = new JButton("up 5F");UF_6 = new JButton("up 6F");UF_7 = new JButton("up 7F");UF_8 = new JButton("up 8F");UF_9 = new JButton("up 9F");UF_10 = new JButton(" 10F ");upfloor.add(UF_10);upfloor.add(UF_9);upfloor.add(UF_8);upfloor.add(UF_7);upfloor.add(UF_6);upfloor.add(UF_5);upfloor.add(UF_4);upfloor.add(UF_3);upfloor.add(UF_2);upfloor.add(UF_1);// 슬라이더 초기화slider = new JSlider(JSlider.VERTICAL); // 수직 방향으로 설정 (VERTICAL)slider.setPaintTicks(false);slider.setMajorTickSpacing(10);slider.setMinorTickSpacing(2);slider.setMinimum(0); // 최소값slider.setMaximum(100); // 최대값slider.setValue(7);slider.setBackground(Color.darkGray);// 텍스트필드와 시작/정지 버튼을 위한 판넬JPanel action = new JPanel();action.setLayout(new GridLayout(2,1,1,1));mlse); // Size 고정status = 1; // 엘리베이터의 현재위치}// 버튼의 상태를 설정하는 메소드 request -> 요청한 층, set -> Color를 선택void setFloorUpButton(int request, boolean set){switch (request) {case 1 : {if (set == true) { UF_1.setBackground(Color.yellow); }else if (set == false) { UF_1.setBackground(Color.lightGray); }break;}case 2 : {if (set == true) { UF_2.setBackground(Color.yellow); }else if (set == false) { UF_2.setBackground(Color.lightGray); }break;}case 3 : {if (set == true) { UF_3.setBackground(Color.yellow); }else if (set == false) { UF_3.setBackground(Color.lightGray); }break;}case 4 : {if (set == true) { UF_4.setBackground(Color.yellow); }else if (set == false) { UF_4.setBackground(Color.lightGray); }break;}case 5 : {if (set == true) { UF_5.setBackground(Color.yellow); }else if (set == false) { UF_5.setBackground(Color.lightGray); }break;}case 6 : {if (set == true) { UF_6.setBackground(Color.yellow); }else if (set == false) { UF_6.setBackground(Color.lightGray); }break;}case 7 : {if (set == true) { UF_7d(Color.lightGray); }break;}case 2 : {if (set == true) { DF_2.setBackground(Color.yellow); }else if (set == false) { DF_2.setBackground(Color.lightGray); }break;}case 3 : {if (set == true) { DF_3.setBackground(Color.yellow); }else if (set == false) { DF_3.setBackground(Color.lightGray); }break;}case 4 : {if (set == true) { DF_4.setBackground(Color.yellow); }else if (set == false) { DF_4.setBackground(Color.lightGray); }break;}case 5 : {if (set == true) { DF_5.setBackground(Color.yellow); }else if (set == false) { DF_5.setBackground(Color.lightGray); }break;}case 6 : {if (set == true) { DF_6.setBackground(Color.yellow); }else if (set == false) { DF_6.setBackground(Color.lightGray); }break;}case 7 : {if (set == true) { DF_7.setBackground(Color.yellow); }else if (set == false) { DF_7.setBackground(Color.lightGray); }break;}case 8 : {if (set == true) { DF_8.setBackground(Color.yellow); }else if (set == false) { DF_8.setBackground(Color.lightGray); }break;}case 9 : {if (set == true) { DF_9.ue);down(rfloor, gfloor);}else ;// 스레드의 타임 슬립 500 mstry { sleep(500); } catch (Exception e) { }}}void up(int r, int g){findmove(r, g, true); // 요청된 위치까지 찾아 간다.E.ment.setText(" Destination " + "-> " + g + "F");try { sleep(500); } catch (Exception e1) { }// 요청된 위치에서 엘리베이터를 상승시킨다.for(int i = r * 10 - 3; i = g * 10 - 3; i--) {E.slider.setValue(i);int f = (i + 3) / 10;E.ment.setText(" Down " + "-> " + g + "F" + " now :" + f + "F");try { sleep(100); } catch (Exception e2) { }}E.setFloorDownButton(g, true);try { sleep(500); } catch (Exception e3) { }E.setFloorDownButton(g, false);E.status = g;}void findmove(int r, int g, boolean ud){// 상승하여 요청된 위치까지 찾아 간다.if(E.status < r) {for(int i = E.status * 10 - 3; i r) {for(int i = E.status * 10 - 3; i >= r * 10 - 3; i--) {E.slider.setValue(i);int f = (i + 3) / 10;E.ment.setText(" Request " + r + "F" + " now :" + f + "F");try { sleep(100); } catch (Exception e3) { }}try { sleep(500); } catch (Exception e4) { }if(ud == true) E.setFloorUpButton(r, false)}
    공학/기술| 2001.11.26| 11페이지| 1,000원| 조회(2,251)
    미리보기
전체보기
해캠 AI 챗봇과 대화하기
챗봇으로 간편하게 상담해보세요.
2026년 04월 18일 토요일
AI 챗봇
안녕하세요. 해피캠퍼스 AI 챗봇입니다. 무엇이 궁금하신가요?
3:20 오전
문서 초안을 생성해주는 EasyAI
안녕하세요 해피캠퍼스의 20년의 운영 노하우를 이용하여 당신만의 초안을 만들어주는 EasyAI 입니다.
저는 아래와 같이 작업을 도와드립니다.
- 주제만 입력하면 AI가 방대한 정보를 재가공하여, 최적의 목차와 내용을 자동으로 만들어 드립니다.
- 장문의 콘텐츠를 쉽고 빠르게 작성해 드립니다.
- 스토어에서 무료 이용권를 계정별로 1회 발급 받을 수 있습니다. 지금 바로 체험해 보세요!
이런 주제들을 입력해 보세요.
- 유아에게 적합한 문학작품의 기준과 특성
- 한국인의 가치관 중에서 정신적 가치관을 이루는 것들을 문화적 문법으로 정리하고, 현대한국사회에서 일어나는 사건과 사고를 비교하여 자신의 의견으로 기술하세요
- 작별인사 독후감