mirror of
https://github.com/robertvokac/time-calc.git
synced 2025-03-25 07:27:49 +01:00
Time improvements - wip1
This commit is contained in:
parent
eb7e190949
commit
4ab6553c11
@ -246,6 +246,9 @@ public class TimeCalcManager {
|
|||||||
|
|
||||||
AnalogClock analogClock = new AnalogClock(startTime, endTime);
|
AnalogClock analogClock = new AnalogClock(startTime, endTime);
|
||||||
analogClock.setBounds(MARGIN, MARGIN, 200);
|
analogClock.setBounds(MARGIN, MARGIN, 200);
|
||||||
|
analogClock.hourProperty.bindTo(time.hourProperty);
|
||||||
|
analogClock.minuteProperty.bindTo(time.minuteProperty);
|
||||||
|
analogClock.secondProperty.bindTo(time.secondProperty);
|
||||||
|
|
||||||
window.add(analogClock);
|
window.add(analogClock);
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ import java.awt.RenderingHints;
|
|||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
|
import org.nanoboot.utils.timecalc.utils.property.IntegerProperty;
|
||||||
|
|
||||||
//https://kodejava.org/how-do-i-write-a-simple-analog-clock-using-java-2d/
|
//https://kodejava.org/how-do-i-write-a-simple-analog-clock-using-java-2d/
|
||||||
public class AnalogClock extends Widget {
|
public class AnalogClock extends Widget {
|
||||||
@ -27,6 +28,19 @@ public class AnalogClock extends Widget {
|
|||||||
private TimeHM endTime;
|
private TimeHM endTime;
|
||||||
private int startAngle;
|
private int startAngle;
|
||||||
private int endAngle;
|
private int endAngle;
|
||||||
|
|
||||||
|
public IntegerProperty startHourProperty = new IntegerProperty("startHourProperty");
|
||||||
|
public IntegerProperty startMinuteProperty = new IntegerProperty("startMinuteProperty");
|
||||||
|
public IntegerProperty endHourProperty = new IntegerProperty("endHourProperty");
|
||||||
|
public IntegerProperty endMinuteProperty = new IntegerProperty("endMinuteProperty");
|
||||||
|
public IntegerProperty yearProperty = new IntegerProperty("yearProperty");
|
||||||
|
public IntegerProperty monthProperty = new IntegerProperty("monthProperty");
|
||||||
|
public IntegerProperty dayProperty = new IntegerProperty("dayProperty");
|
||||||
|
public IntegerProperty hourProperty = new IntegerProperty("hourProperty");
|
||||||
|
public IntegerProperty minuteProperty = new IntegerProperty("minuteProperty");
|
||||||
|
public IntegerProperty secondProperty = new IntegerProperty("secondProperty");
|
||||||
|
public IntegerProperty millisecondProperty = new IntegerProperty("millisecondProperty");
|
||||||
|
public IntegerProperty dayOfWeekProperty = new IntegerProperty("dayOfWeek");
|
||||||
|
|
||||||
public AnalogClock(TimeHM startTimeIn,
|
public AnalogClock(TimeHM startTimeIn,
|
||||||
TimeHM endTimeIn) {
|
TimeHM endTimeIn) {
|
||||||
@ -87,11 +101,11 @@ public class AnalogClock extends Widget {
|
|||||||
int centerX = getWidth() / 2;
|
int centerX = getWidth() / 2;
|
||||||
int centerY = getHeight() / 2;
|
int centerY = getHeight() / 2;
|
||||||
|
|
||||||
GregorianCalendar time = new GregorianCalendar();
|
|
||||||
int millisecond = time.get(Calendar.MILLISECOND);
|
int millisecond = millisecondProperty.getValue();
|
||||||
int second = time.get(Calendar.SECOND);
|
int second = secondProperty.getValue();
|
||||||
int minute = time.get(Calendar.MINUTE);
|
int minute = minuteProperty.getValue();
|
||||||
int hour = time.get(Calendar.HOUR_OF_DAY);
|
int hour = hourProperty.getValue();
|
||||||
|
|
||||||
if(mouseOver && visibility.isStronglyColored()) {
|
if(mouseOver && visibility.isStronglyColored()) {
|
||||||
this.startTime = new TimeHM(hour, minute);
|
this.startTime = new TimeHM(hour, minute);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user