수다닷컴

  • 해외여행
    • 괌
    • 태국
    • 유럽
    • 일본
    • 필리핀
    • 미국
    • 중국
    • 기타여행
    • 싱가폴
  • 건강
    • 다이어트
    • 당뇨
    • 헬스
    • 건강음식
    • 건강기타
  • 컴퓨터
    • 프로그램 개발일반
    • C언어
    • 비주얼베이직
  • 결혼생활
    • 출산/육아
    • 결혼준비
    • 엄마이야기방
  • 일상생활
    • 면접
    • 취업
    • 진로선택
  • 교육
    • 교육일반
    • 아이교육
    • 토익
    • 해외연수
    • 영어
  • 취미생활
    • 음악
    • 자전거
    • 수영
    • 바이크
    • 축구
  • 기타
    • 강아지
    • 제주도여행
    • 국내여행
    • 기타일상
    • 애플
    • 휴대폰관련
  • 프로그램 개발일반
  • C언어
  • 비주얼베이직

자바로 스탑워치 소스를 받았는데 각 소스마다 주석좀 달아주세요ㅠㅠ

Isolation

2023.04.01



자바로짜퓆bsp;짜여진 스탑워치 프로그램 소스입니다.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class stopwatch extends jframe implements actionlistener, runnable
{
container con;
jbutton start,stop,reset;
boolean is;
jpanel top,center;
long hour=0;
long min=0;
long sec=0;
long msec=0;
string time=00 : 00 : 00 . 00;
canvas can;
public stopwatch()
{
init();
setdefaultcloseoperation(exit_on_close);
setsize(300,120);
setvisible(true);
}
public void init()
{
con=getcontentpane();
start=new jbutton(시작);
stop=new jbutton(중지);
reset=new jbutton(재설정);
top=new jpanel();

start.addactionlistener(this);
stop.addactionlistener(this);
reset.addactionlistener(this);
top.add(start);
top.add(stop);
top.add(reset);

con.add(top,north);

}
public void actionperformed(actionevent e)
{
jbutton jb=(jbutton)e.getsource();
if (jb==start)
{
is=true;
}
else if (jb==stop)
{
is=false;
}
else if (jb==reset)
{
resettimes();
}
}
public long minustimes()
{

long total=(hour*60*60*100)+(min*60*100)+(sec*100)+msec+1;
if (total=0)
{
is=false;
}
return total;
}
public void resettimes()
{
hour=0;
min=0;
sec=0;
msec=0;
time=00 : 00 : 00 . 00;
is=false;
repaint();
}

public void settimes()
{
long total=minustimes();

hour=(long)((total/100)/(60*60));
min=(long)((total/100)%(60*60)/60);
sec=(long)((total/100)%(60*60)%60);
msec=(long)(total-((hour*60*60*100)+(min*60*100)+(sec*100)));

string []times=new string[4];
times[0]=hour+;
times[1]=min+;
times[2]=sec+;
times[3]=msec+;
for (int i=0; i times.length ; ++i )
{
if (times[i].length()2)
{
times[i]=0+times[i];
}
}
time=times[0]+ : +times[1]+ : +times[2]+ . +times[3];
}
public void paint(graphics g)
{
g=getgraphics();

g.setcolor(color.white);
g.fillrect(0,70,400,100);
g.setcolor(color.black);
g.drawstring(time,100,100);
top.updateui();
}
public void run()
{
while (true)
{
if (is)
{
try
{
settimes();
repaint();
thread.sleep(10);
}
catch (exception e)
{
}
}
}
}
public static void main(string[] args)
{
new thread(new stopwatch()).start();
}
}


각 소스마다 설명좀 부탁드립니다ㅠㅠㅠ좀 급해요ㅠㅠㅠㅠㅠ

신청하기





COMMENT

댓글을 입력해주세요. 비속어와 욕설은 삼가해주세요.

번호 제 목 글쓴이 날짜
2700579 (air + as3) smtp 이용해서 첨부파일 포함해서 메일 보내기 물보라 2025-07-06
2700524 클릭시 밑에 메뉴 나오게 (4) 새솔 2025-07-05
2700505 activex를 비쥬얼6.0으로 만들었는데요 비스타 배포시에 안되서 질문드립니다 (3) 참이 2025-07-05
2700452 c언어에서... 자료형 구분.... (3) 시내 2025-07-05
2700422 버전에 관해 질문 라온제나 2025-07-04
2700393 mysql이 갑자기!!!!!!!!!!!!!!!에러가;; (2) 소미 2025-07-04
2700359 3.0 ) SimpleButton 상태 강제 변경 (3) 희선 2025-07-04
2700304 ie8 전용핵 문의 (3) 여자 2025-07-03
2700281 이런경우 어떻게 코딩해야 표준에 따르는건가요? (6) 늘솜 2025-07-03
2700230 질문이여 ! 뿡뿡몬 2025-07-03
2700205 액션스크립트책 좀 추천해주세요. (10) 화이트캣 2025-07-02
2700173 자바 소스인데 어떤게 에러인지..? (1) 호빵녀 2025-07-02
2700142 하단이 붙어있는 가변 레이아웃구조 질문드립니다. 이플 2025-07-02
2700089 이미지를 사다리꼴로 비틀게 하는 액션코드가 있나요? (4) 여름 2025-07-01
2700033 배경에 그라데이션을 넣으려고 하는데요.. (4) 화이티 2025-07-01
2700005 [질문] TextField 객체의 실제 높이 알아오는 방법 ? 천사의눈물 2025-07-01
2699978 FileReferenceList를 이용하여 업로드시 자꾸 실행속도가 느리다는 팝업이... (10) 데이비드 2025-06-30
2699944 자바스크립트가 많은 사이트는... (6) 희나리 2025-06-30
2699918 브라우저마다 다른 input과 텍스트 정렬 (3) 늘봄 2025-06-30
2699887 동적텍스트를 그래픽으로?? (2) 족장 2025-06-30
<<  이전  1 2 3 4 5 6 7 8 9 10  다음  >>

수다닷컴 | 여러분과 함께하는 수다토크 커뮤니티 수다닷컴에 오신것을 환영합니다.
사업자등록번호 : 117-07-92748 상호 : 진달래여행사 대표자 : 명현재 서울시 강서구 방화동 890번지 푸르지오 107동 306호
copyright 2011 게시글 삭제 및 기타 문의 : clairacademy@naver.com