Added new improvements

This commit is contained in:
Robert Vokac 2024-02-11 13:10:46 +00:00
parent cdf9219573
commit e7f075c8bd
No known key found for this signature in database
GPG Key ID: 693D30BEE3329055
3 changed files with 30 additions and 13 deletions

View File

@ -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(

View File

@ -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) {

View File

@ -0,0 +1,16 @@
package org.nanoboot.utils.timecalc.utils.property;
/**
* @author Robert Vokac
* @since 16.02.2024
*/
public class DoubleProperty extends Property<Double> {
public DoubleProperty(String name, Double valueIn) {
super(name, valueIn);
}
public DoubleProperty(String name) {
this(name, 0d);
}
}