mirror of
https://github.com/robertvokac/time-calc.git
synced 2025-03-25 07:27:49 +01:00
Added changing current date for testing purposes
This commit is contained in:
parent
9a68801679
commit
eb7e190949
@ -29,11 +29,18 @@ import java.awt.Font;
|
|||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
import java.awt.event.KeyAdapter;
|
import java.awt.event.KeyAdapter;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.IOException;
|
||||||
import java.time.DayOfWeek;
|
import java.time.DayOfWeek;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Properties;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Robert Vokac
|
* @author Robert Vokac
|
||||||
@ -270,6 +277,27 @@ public class TimeCalcManager {
|
|||||||
Calendar calNow = Calendar.getInstance();
|
Calendar calNow = Calendar.getInstance();
|
||||||
calNow.setTime(new Date());
|
calNow.setTime(new Date());
|
||||||
|
|
||||||
|
Properties testProperties = new Properties();
|
||||||
|
File testPropertiesFile = new File("test.txt");
|
||||||
|
try {
|
||||||
|
if(testPropertiesFile.exists()) {
|
||||||
|
testProperties.load(new FileInputStream(testPropertiesFile));
|
||||||
|
}
|
||||||
|
} catch (FileNotFoundException ex) {
|
||||||
|
Logger.getLogger(TimeCalcManager.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
|
} catch (IOException rex) {
|
||||||
|
Logger.getLogger(TimeCalcManager.class.getName()).log(Level.SEVERE, null, rex);
|
||||||
|
}
|
||||||
|
System.out.println("current dir=" + new File(".").getAbsolutePath());
|
||||||
|
if(testProperties.containsKey("current.day")) {
|
||||||
|
calNow.set(Calendar.DAY_OF_MONTH, Integer.parseInt((String) testProperties.get("current.day")));
|
||||||
|
}
|
||||||
|
if(testProperties.containsKey("current.month")) {
|
||||||
|
calNow.set(Calendar.MONTH, Integer.parseInt((String) testProperties.get("current.month")) - 1);
|
||||||
|
}
|
||||||
|
if(testProperties.containsKey("current.year")) {
|
||||||
|
calNow.set(Calendar.YEAR, Integer.parseInt((String) testProperties.get("current.year")));
|
||||||
|
}
|
||||||
int currentDayOfMonth = calNow.get(Calendar.DAY_OF_MONTH);
|
int currentDayOfMonth = calNow.get(Calendar.DAY_OF_MONTH);
|
||||||
|
|
||||||
int workDaysDone = 0;
|
int workDaysDone = 0;
|
||||||
|
@ -110,7 +110,6 @@ public class AnalogClock extends Widget {
|
|||||||
// Draw clock numbers and circle
|
// Draw clock numbers and circle
|
||||||
drawClockFace(g2d, centerX, centerY, side / 2 - 40, visibility);
|
drawClockFace(g2d, centerX, centerY, side / 2 - 40, visibility);
|
||||||
|
|
||||||
System.out.println("millisecond=" + millisecond);
|
|
||||||
//
|
//
|
||||||
drawHand(g2d, side / 2 - 10, millisecond / 1000.0, 1.0f,
|
drawHand(g2d, side / 2 - 10, millisecond / 1000.0, 1.0f,
|
||||||
COLOR_FOR_MILLISECOND_HAND_STRONGLY_COLORED, visibility);
|
COLOR_FOR_MILLISECOND_HAND_STRONGLY_COLORED, visibility);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user