목차
JAVA 디지털 시계
Digital Clock
[Binary] 398KB
StopWatch.exe
StopWatch.jar
[Source] 15.5KB
[com.jinhyuk.Clock]
[.settings]
[bin]
[src]
.classpath
.project
Digital Clock
[Binary] 398KB
StopWatch.exe
StopWatch.jar
[Source] 15.5KB
[com.jinhyuk.Clock]
[.settings]
[bin]
[src]
.classpath
.project
본문내용
import java.text.*;
import java.util.Date;
public class Clock {
private int Hours;
private int Minutes;
private int Seconds;
private int MSeconds;
public Clock(){
Hours = 0;
Minutes = 0;
Seconds = 0;
MSeconds = 0;
}
public String displayTime(){
MessageFormat mf = new MessageFormat("{0}:{1}:{2}.");
DecimalFormat df = new DecimalFormat("00");
Object[] objs = {df.format(Hours), df.format(Minutes), df.format(Seconds)};
return mf.format(objs);
}
public String displayTime2(){
MessageFormat mf = new MessageFormat("{0}");
DecimalFormat df = new DecimalFormat("00");
Object[] objs = {df.format(MSeconds)};
return mf.format(objs);
}
public void increaseMSeconds(long mtime, long total){
long end = System.currentTimeMillis();
Date newDate = new Date();
MSeconds = (int) (((end - mtime) + total) / 10);
Hours = Minutes / (3600 * 100);
Minutes = (MSeconds - Hours * 3600 * 100) / (60 * 100);
Seconds = (MSeconds - Hours * 3600 * 100 - Minutes * 60 * 100) / 100;
MSeconds = MSeconds - Hours * 3600 * 100 - Minutes * 60 * 100 - Seconds * 100;
}
public void resetClock(){
Hours = 0;
Minutes = 0;
Seconds = 0;
MSeconds = 0;
}
}
import java.util.Date;
public class Clock {
private int Hours;
private int Minutes;
private int Seconds;
private int MSeconds;
public Clock(){
Hours = 0;
Minutes = 0;
Seconds = 0;
MSeconds = 0;
}
public String displayTime(){
MessageFormat mf = new MessageFormat("{0}:{1}:{2}.");
DecimalFormat df = new DecimalFormat("00");
Object[] objs = {df.format(Hours), df.format(Minutes), df.format(Seconds)};
return mf.format(objs);
}
public String displayTime2(){
MessageFormat mf = new MessageFormat("{0}");
DecimalFormat df = new DecimalFormat("00");
Object[] objs = {df.format(MSeconds)};
return mf.format(objs);
}
public void increaseMSeconds(long mtime, long total){
long end = System.currentTimeMillis();
Date newDate = new Date();
MSeconds = (int) (((end - mtime) + total) / 10);
Hours = Minutes / (3600 * 100);
Minutes = (MSeconds - Hours * 3600 * 100) / (60 * 100);
Seconds = (MSeconds - Hours * 3600 * 100 - Minutes * 60 * 100) / 100;
MSeconds = MSeconds - Hours * 3600 * 100 - Minutes * 60 * 100 - Seconds * 100;
}
public void resetClock(){
Hours = 0;
Minutes = 0;
Seconds = 0;
MSeconds = 0;
}
}
추천자료
자바를 이용한 계산기 만들기(GUI)
자바 프로젝트 기차 자리 프로그램 term 프로젝트
자바 프로젝트 도서관 자리 프로그램 term 프로젝트
자바 프로젝트 레스토랑 관리 프로그램 term project
자바 프로젝트 버스외상관리 프로그램 term project
자바 프로젝트 비디오 관리 프로그램 term project
자바 프로젝트 신원조회 프로그램 term project
자바 프로젝트 은행 프로그램 term project
자바 프로젝트 ATM 은행 프로그램 term project
자바로 ExchangeMoney(환전) 구현
(자바)연락처 입력, 삭제 검색 프로그램
자바 별표
채팅 프로그램(자바)
소개글