mirror of
https://github.com/robertvokac/time-calc.git
synced 2025-03-25 07:27:49 +01:00
Added new improvements
This commit is contained in:
parent
cdf9219573
commit
e7f075c8bd
@ -126,7 +126,7 @@ public class TimeCalcManager {
|
|||||||
window.setLayout(null);
|
window.setLayout(null);
|
||||||
window.setVisible(true);
|
window.setVisible(true);
|
||||||
|
|
||||||
String windowTitle = createWindowTitle();
|
String windowTitle = "Time Calc " + Utils.getVersion();
|
||||||
window.setTitle(windowTitle);
|
window.setTitle(windowTitle);
|
||||||
|
|
||||||
weatherButton
|
weatherButton
|
||||||
@ -201,7 +201,7 @@ public class TimeCalcManager {
|
|||||||
dayBattery.getY() + dayBattery.getHeight() + SwingUtils.MARGIN, 140);
|
dayBattery.getY() + dayBattery.getHeight() + SwingUtils.MARGIN, 140);
|
||||||
window.add(weekBattery);
|
window.add(weekBattery);
|
||||||
|
|
||||||
int currentDayOfMonth = calNow.get(Calendar.DAY_OF_MONTH);
|
int currentDayOfMonth = analogClock.dayProperty.getValue();
|
||||||
|
|
||||||
int workDaysDone = 0;
|
int workDaysDone = 0;
|
||||||
int workDaysTodo = 0;
|
int workDaysTodo = 0;
|
||||||
@ -209,8 +209,8 @@ public class TimeCalcManager {
|
|||||||
for (int dayOfMonth = 1;
|
for (int dayOfMonth = 1;
|
||||||
dayOfMonth <= calNow.getActualMaximum(Calendar.DAY_OF_MONTH);
|
dayOfMonth <= calNow.getActualMaximum(Calendar.DAY_OF_MONTH);
|
||||||
dayOfMonth++) {
|
dayOfMonth++) {
|
||||||
DayOfWeek dayOfWeek = LocalDate.of(calNow.get(Calendar.YEAR),
|
DayOfWeek dayOfWeek = LocalDate.of(analogClock.yearProperty.getValue(),
|
||||||
calNow.get(Calendar.MONTH) + 1, dayOfMonth).getDayOfWeek();
|
analogClock.monthProperty.getValue(), dayOfMonth).getDayOfWeek();
|
||||||
boolean weekend =
|
boolean weekend =
|
||||||
dayOfWeek.toString().equals("SATURDAY") || dayOfWeek
|
dayOfWeek.toString().equals("SATURDAY") || dayOfWeek
|
||||||
.toString().equals("SUNDAY");
|
.toString().equals("SUNDAY");
|
||||||
@ -375,20 +375,11 @@ public class TimeCalcManager {
|
|||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
walkingHumanProgressAsciiArt.setForeground(
|
|
||||||
currentVisibility.isStronglyColored()
|
|
||||||
|| walkingHumanProgressAsciiArt
|
|
||||||
.getClientProperty("mouseEntered").equals("true") ?
|
|
||||||
Color.BLACK : Color.LIGHT_GRAY);
|
|
||||||
}
|
}
|
||||||
window.setVisible(false);
|
window.setVisible(false);
|
||||||
window.dispose();
|
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) {
|
private void bindToIfPropertyMissing(Properties properties, String key, Calendar cal, int timeUnit, IntegerProperty firstProperty, Property secondProperty) {
|
||||||
if (properties.containsKey(key)) {
|
if (properties.containsKey(key)) {
|
||||||
cal.set(timeUnit, Integer.parseInt(
|
cal.set(timeUnit, Integer.parseInt(
|
||||||
|
@ -14,6 +14,7 @@ import org.nanoboot.utils.timecalc.utils.property.StringProperty;
|
|||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
import javax.swing.JTextPane;
|
import javax.swing.JTextPane;
|
||||||
|
import javax.swing.Timer;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
@ -76,6 +77,15 @@ public class WalkingHumanProgressAsciiArt extends JTextPane implements
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
setBounds(x, y, width, height);
|
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) {
|
private static final String createSpaces(int spaceCount) {
|
||||||
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user