diff --git a/modules/time-calc-app/src/main/java/org/nanoboot/utils/timecalc/app/TimeCalcManager.java b/modules/time-calc-app/src/main/java/org/nanoboot/utils/timecalc/app/TimeCalcManager.java index 5d98609..cade6cf 100644 --- a/modules/time-calc-app/src/main/java/org/nanoboot/utils/timecalc/app/TimeCalcManager.java +++ b/modules/time-calc-app/src/main/java/org/nanoboot/utils/timecalc/app/TimeCalcManager.java @@ -126,7 +126,7 @@ public class TimeCalcManager { window.setLayout(null); window.setVisible(true); - String windowTitle = createWindowTitle(); + String windowTitle = "Time Calc " + Utils.getVersion(); window.setTitle(windowTitle); weatherButton @@ -201,7 +201,7 @@ public class TimeCalcManager { dayBattery.getY() + dayBattery.getHeight() + SwingUtils.MARGIN, 140); window.add(weekBattery); - int currentDayOfMonth = calNow.get(Calendar.DAY_OF_MONTH); + int currentDayOfMonth = analogClock.dayProperty.getValue(); int workDaysDone = 0; int workDaysTodo = 0; @@ -209,8 +209,8 @@ public class TimeCalcManager { for (int dayOfMonth = 1; dayOfMonth <= calNow.getActualMaximum(Calendar.DAY_OF_MONTH); dayOfMonth++) { - DayOfWeek dayOfWeek = LocalDate.of(calNow.get(Calendar.YEAR), - calNow.get(Calendar.MONTH) + 1, dayOfMonth).getDayOfWeek(); + DayOfWeek dayOfWeek = LocalDate.of(analogClock.yearProperty.getValue(), + analogClock.monthProperty.getValue(), dayOfMonth).getDayOfWeek(); boolean weekend = dayOfWeek.toString().equals("SATURDAY") || dayOfWeek .toString().equals("SUNDAY"); @@ -375,20 +375,11 @@ public class TimeCalcManager { } catch (InterruptedException e) { } - - walkingHumanProgressAsciiArt.setForeground( - currentVisibility.isStronglyColored() - || walkingHumanProgressAsciiArt - .getClientProperty("mouseEntered").equals("true") ? - Color.BLACK : Color.LIGHT_GRAY); } window.setVisible(false); window.dispose(); } - private String createWindowTitle() { - return "Time Calc " + Utils.getVersion(); - } private void bindToIfPropertyMissing(Properties properties, String key, Calendar cal, int timeUnit, IntegerProperty firstProperty, Property secondProperty) { if (properties.containsKey(key)) { cal.set(timeUnit, Integer.parseInt( diff --git a/modules/time-calc-app/src/main/java/org/nanoboot/utils/timecalc/swing/progress/WalkingHumanProgressAsciiArt.java b/modules/time-calc-app/src/main/java/org/nanoboot/utils/timecalc/swing/progress/WalkingHumanProgressAsciiArt.java index 00cce30..de6858b 100644 --- a/modules/time-calc-app/src/main/java/org/nanoboot/utils/timecalc/swing/progress/WalkingHumanProgressAsciiArt.java +++ b/modules/time-calc-app/src/main/java/org/nanoboot/utils/timecalc/swing/progress/WalkingHumanProgressAsciiArt.java @@ -14,6 +14,7 @@ import org.nanoboot.utils.timecalc.utils.property.StringProperty; import javax.imageio.ImageIO; import javax.swing.ImageIcon; import javax.swing.JTextPane; +import javax.swing.Timer; import java.awt.Color; import java.awt.Font; import java.awt.event.MouseEvent; @@ -76,6 +77,15 @@ public class WalkingHumanProgressAsciiArt extends JTextPane implements } }); setBounds(x, y, width, height); + new Timer(100, e -> { + Visibility visibility = + Visibility.valueOf(visibilityProperty.getValue()); + setForeground( + visibility.isStronglyColored() + || getClientProperty("mouseEntered").equals("true") ? + Color.BLACK : Color.LIGHT_GRAY); + }).start(); + } private static final String createSpaces(int spaceCount) { diff --git a/modules/time-calc-app/src/main/java/org/nanoboot/utils/timecalc/utils/property/DoubleProperty.java b/modules/time-calc-app/src/main/java/org/nanoboot/utils/timecalc/utils/property/DoubleProperty.java new file mode 100644 index 0000000..6d387aa --- /dev/null +++ b/modules/time-calc-app/src/main/java/org/nanoboot/utils/timecalc/utils/property/DoubleProperty.java @@ -0,0 +1,16 @@ +package org.nanoboot.utils.timecalc.utils.property; + +/** + * @author Robert Vokac + * @since 16.02.2024 + */ +public class DoubleProperty extends Property { + + public DoubleProperty(String name, Double valueIn) { + super(name, valueIn); + } + + public DoubleProperty(String name) { + this(name, 0d); + } +}