Added improvements
This commit is contained in:
parent
6b0cc58ff1
commit
c89d5e6022
@ -31,6 +31,8 @@ public class TimeCalcConfiguration {
|
||||
public final BooleanProperty clockHandsColoredProperty
|
||||
= new BooleanProperty(TimeCalcProperty.CLOCK_HANDS_COLORED
|
||||
.getKey());
|
||||
public final BooleanProperty clockHandsHourVisibleProperty
|
||||
= new BooleanProperty(TimeCalcProperty.CLOCK_HANDS_HOUR_VISIBLE.getKey());
|
||||
public final BooleanProperty clockHandsMinuteVisibleProperty
|
||||
= new BooleanProperty(TimeCalcProperty.CLOCK_HANDS_MINUTE_VISIBLE
|
||||
.getKey());
|
||||
@ -149,6 +151,7 @@ public class TimeCalcConfiguration {
|
||||
clockVisibleProperty,
|
||||
clockHandsLongVisibleProperty,
|
||||
clockHandsColoredProperty,
|
||||
clockHandsHourVisibleProperty,
|
||||
clockHandsMinuteVisibleProperty,
|
||||
clockHandsSecondVisibleProperty,
|
||||
clockHandsMillisecondVisibleProperty,
|
||||
|
@ -14,9 +14,10 @@ public enum TimeCalcProperty {
|
||||
VISIBILITY_DEFAULT("visibility.default", "Default Visibility"),
|
||||
VISIBILITY_SUPPORTED_COLORED("visibility.supported.colored", "Visibility : Supported : Colored"),
|
||||
//
|
||||
CLOCK_VISIBLE("clock.hands.long.visible", "Clock"),
|
||||
CLOCK_HANDS_LONG_VISIBLE("clock.hands.long.visible", "Clock : Hands are long"),
|
||||
CLOCK_HANDS_COLORED("clock.hands.colored", "Clock : Hands are colored"),
|
||||
CLOCK_VISIBLE("clock.visible", "Clock"),
|
||||
CLOCK_HANDS_LONG_VISIBLE("clock.hands.long.visible", "Clock : Long Hands"),
|
||||
CLOCK_HANDS_COLORED("clock.hands.colored", "Clock : Colored Hands"),
|
||||
CLOCK_HANDS_HOUR_VISIBLE("clock.hands.hour.visible", "Clock : Hour hand"),
|
||||
CLOCK_HANDS_MINUTE_VISIBLE("clock.hands.minute.visible", "Clock : Minute hand"),
|
||||
CLOCK_HANDS_SECOND_VISIBLE("clock.hands.second.visible", "Clock : Second hand"),
|
||||
CLOCK_HANDS_MILLISECOND_VISIBLE("clock.hands.millisecond.visible", "Clock : Millisecond hand"),
|
||||
|
@ -13,6 +13,7 @@ import javax.swing.JComponent;
|
||||
import javax.swing.JLabel;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
import java.awt.event.WindowAdapter;
|
||||
@ -23,6 +24,12 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.swing.Box;
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JSeparator;
|
||||
import javax.swing.SwingConstants;
|
||||
|
||||
/**
|
||||
* @author Robert Vokac
|
||||
@ -44,10 +51,14 @@ public class ConfigWindow extends TWindow {
|
||||
|
||||
private JCheckBox visibilitySupportedColoredProperty
|
||||
= new JCheckBox(TimeCalcProperty.VISIBILITY_SUPPORTED_COLORED.getKey());
|
||||
private JCheckBox clockVisibleProperty
|
||||
= new JCheckBox(TimeCalcProperty.CLOCK_VISIBLE.getKey());
|
||||
private JCheckBox clockHandsLongVisibleProperty
|
||||
= new JCheckBox(TimeCalcProperty.CLOCK_HANDS_LONG_VISIBLE.getKey());
|
||||
private JCheckBox clockHandsColoredProperty
|
||||
= new JCheckBox(TimeCalcProperty.CLOCK_HANDS_COLORED.getKey());
|
||||
private JCheckBox clockHandsHourVisibleProperty
|
||||
= new JCheckBox(TimeCalcProperty.CLOCK_HANDS_HOUR_VISIBLE.getKey());
|
||||
private JCheckBox clockHandsMinuteVisibleProperty
|
||||
= new JCheckBox(TimeCalcProperty.CLOCK_HANDS_MINUTE_VISIBLE.getKey());
|
||||
private JCheckBox clockHandsSecondVisibleProperty
|
||||
@ -120,26 +131,53 @@ public class ConfigWindow extends TWindow {
|
||||
= new JCheckBox(TimeCalcProperty.CIRCLE_VISIBLE.getKey());
|
||||
private JCheckBox walkingHumanVisibleProperty
|
||||
= new JCheckBox(TimeCalcProperty.WALKING_HUMAN_VISIBLE.getKey());
|
||||
private final JPanel panelInsideScrollPane;
|
||||
|
||||
public ConfigWindow(TimeCalcConfiguration timeCalcConfiguration) {
|
||||
this.timeCalcConfiguration = timeCalcConfiguration;
|
||||
setTitle("Configuration");
|
||||
this.setSize(800, 1000);
|
||||
setLayout(null);
|
||||
|
||||
add(enableAsMuchAsPossible);
|
||||
enableAsMuchAsPossible.setBounds(SwingUtils.MARGIN, currentY, 250,
|
||||
this.setSize(800, 800);
|
||||
|
||||
JPanel mainPanel = new JPanel();
|
||||
mainPanel.setMaximumSize(new Dimension(Integer.MAX_VALUE, getHeight() - 6 * SwingUtils.MARGIN));
|
||||
this.panelInsideScrollPane = new JPanel();
|
||||
final BoxLayout boxLayout = new BoxLayout(panelInsideScrollPane, BoxLayout.Y_AXIS);
|
||||
panelInsideScrollPane.setAlignmentX(LEFT_ALIGNMENT);
|
||||
mainPanel.setAlignmentX(LEFT_ALIGNMENT);
|
||||
|
||||
panelInsideScrollPane.setLayout(boxLayout);
|
||||
panelInsideScrollPane.setMinimumSize(new Dimension(Integer.MAX_VALUE, 400));
|
||||
|
||||
JScrollPane scrollPane = new JScrollPane(panelInsideScrollPane);
|
||||
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
|
||||
scrollPane.setPreferredSize(new Dimension(getWidth() - 50, getHeight() - 100));
|
||||
scrollPane.setWheelScrollingEnabled(true);
|
||||
scrollPane.setBorder(null);
|
||||
// mainPanel.setBackground(Color.red);
|
||||
// scrollPane.setBackground(Color.green);
|
||||
// panelInsideScrollPane.setBackground(Color.blue);
|
||||
|
||||
add(mainPanel);
|
||||
//mainPanel.setLayout(null);
|
||||
mainPanel.add(enableAsMuchAsPossible);
|
||||
enableAsMuchAsPossible.setBounds(SwingUtils.MARGIN, SwingUtils.MARGIN, 250,
|
||||
HEIGHT1);
|
||||
add(disableAsMuchAsPossible);
|
||||
disableAsMuchAsPossible.setBounds(enableAsMuchAsPossible.getX() + enableAsMuchAsPossible.getWidth() + SwingUtils.MARGIN, currentY, 250,
|
||||
|
||||
mainPanel.add(disableAsMuchAsPossible);
|
||||
disableAsMuchAsPossible.setBounds(enableAsMuchAsPossible.getX() + enableAsMuchAsPossible.getWidth() + SwingUtils.MARGIN, SwingUtils.MARGIN, 250,
|
||||
HEIGHT1);
|
||||
nextRow();
|
||||
scrollPane.setBounds(enableAsMuchAsPossible.getX(), enableAsMuchAsPossible.getY() + enableAsMuchAsPossible.getHeight() + SwingUtils.MARGIN, Integer.MAX_VALUE, Integer.MAX_VALUE);
|
||||
|
||||
mainPanel.add(scrollPane);
|
||||
|
||||
for(boolean enable:new boolean[]{true, false}) {
|
||||
TButton button = enable ? enableAsMuchAsPossible : disableAsMuchAsPossible;
|
||||
|
||||
button.addActionListener(e -> {
|
||||
visibilityDefaultProperty.setSelectedItem(Visibility.STRONGLY_COLORED.name());
|
||||
clockHandsMinuteVisibleProperty.setSelected(true);
|
||||
clockVisibleProperty.setSelected(true);
|
||||
clockHandsHourVisibleProperty.setSelected(enable);
|
||||
clockHandsMinuteVisibleProperty.setSelected(enable);
|
||||
clockHandsSecondVisibleProperty.setSelected(enable);
|
||||
clockHandsMillisecondVisibleProperty.setSelected(enable);
|
||||
clockHandsLongVisibleProperty.setSelected(enable);
|
||||
@ -156,15 +194,14 @@ public class ConfigWindow extends TWindow {
|
||||
clockCentreCircleVisibleProperty.setSelected(enable);
|
||||
clockCentreCircleBlackProperty.setSelected(!enable);
|
||||
clockProgressVisibleOnlyIfMouseMovingOverProperty.setSelected(!enable);
|
||||
clockDateVisibleOnlyIfMouseMovingOverProperty.setSelected(!enable);
|
||||
clockDateVisibleOnlyIfMouseMovingOverProperty.setSelected(false);
|
||||
batteryVisibleProperty.setSelected(true);
|
||||
batteryWavesVisibleProperty.setSelected(enable);
|
||||
batteryCircleProgressVisibleProperty.setSelected(enable);
|
||||
batteryPercentProgressProperty.setSelected(enable);
|
||||
batteryChargingCharacterVisibleProperty.setSelected(enable);
|
||||
batteryNameVisibleProperty.setSelected(enable);
|
||||
batteryLabelVisibleProperty.setSelected(enable);
|
||||
//
|
||||
batteryVisibleProperty.setSelected(true);
|
||||
batteryMinuteVisibleProperty.setSelected(enable);
|
||||
batteryHourVisibleProperty.setSelected(enable);
|
||||
batteryDayVisibleProperty.setSelected(true);
|
||||
@ -187,6 +224,8 @@ public class ConfigWindow extends TWindow {
|
||||
|
||||
propertiesList.addAll(Arrays.asList(visibilityDefaultProperty,
|
||||
visibilitySupportedColoredProperty,
|
||||
clockVisibleProperty,
|
||||
clockHandsHourVisibleProperty,
|
||||
clockHandsMinuteVisibleProperty,
|
||||
clockHandsSecondVisibleProperty,
|
||||
clockHandsMillisecondVisibleProperty,
|
||||
@ -202,14 +241,13 @@ public class ConfigWindow extends TWindow {
|
||||
clockCentreCircleBlackProperty,
|
||||
clockProgressVisibleOnlyIfMouseMovingOverProperty,
|
||||
clockDateVisibleOnlyIfMouseMovingOverProperty,
|
||||
batteryVisibleProperty,
|
||||
batteryWavesVisibleProperty,
|
||||
batteryCircleProgressVisibleProperty,
|
||||
batteryPercentProgressProperty,
|
||||
batteryChargingCharacterVisibleProperty,
|
||||
batteryNameVisibleProperty,
|
||||
batteryLabelVisibleProperty,
|
||||
//
|
||||
batteryVisibleProperty,
|
||||
batteryMinuteVisibleProperty,
|
||||
batteryHourVisibleProperty,
|
||||
batteryDayVisibleProperty,
|
||||
@ -218,24 +256,25 @@ public class ConfigWindow extends TWindow {
|
||||
batteryYearVisibleProperty,
|
||||
batteryBlinkingIfCriticalLowVisibleProperty,
|
||||
//
|
||||
jokesVisibleProperty,
|
||||
commandsVisibleProperty,
|
||||
notificationsVisibleProperty,
|
||||
smileysVisibleProperty,
|
||||
smileysVisibleOnlyIfMouseMovingOverProperty,
|
||||
smileysColoredProperty,
|
||||
jokesVisibleProperty,
|
||||
commandsVisibleProperty,
|
||||
notificationsVisibleProperty,
|
||||
squareVisibleProperty,
|
||||
circleVisibleProperty,
|
||||
walkingHumanVisibleProperty));
|
||||
//
|
||||
propertiesList.stream().forEach(p -> {
|
||||
p.setAlignmentX(LEFT_ALIGNMENT);
|
||||
if (p == visibilityDefaultProperty) {
|
||||
p.putClientProperty(CLIENT_PROPERTY_KEY, TimeCalcProperty.VISIBILITY_DEFAULT.getKey());
|
||||
addToNextRow(new JLabel(TimeCalcProperty.VISIBILITY_DEFAULT.getDescription()));
|
||||
}
|
||||
if (p == clockCircleBorderColorProperty) {
|
||||
p.putClientProperty(CLIENT_PROPERTY_KEY, TimeCalcProperty.CLOCK_CIRCLE_BORDER_COLOR.getKey());
|
||||
addToNextRow(new JLabel(TimeCalcProperty.CLOCK_CIRCLE_BORDER_COLOR.getDescription()));
|
||||
addToNextRow(new JLabel(TimeCalcProperty.CLOCK_CIRCLE_BORDER_COLOR.getDescription().replace("Clock : ", "")));
|
||||
}
|
||||
if (p instanceof JComboBox) {
|
||||
JComboBox jComboBox = ((JComboBox) p);
|
||||
@ -271,12 +310,33 @@ public class ConfigWindow extends TWindow {
|
||||
property
|
||||
.setValue(checkBox.isSelected());
|
||||
});
|
||||
String[] array = checkBox.getText().split(" : ");
|
||||
String groupName = array[0];
|
||||
if(groupName.equals("Clock") ||groupName.equals("Battery") ||groupName.equals("Smileys")) {
|
||||
|
||||
checkBox.setText(array.length > 1 ? (checkBox.getText().substring(groupName.length() + 3)) : "Visible");
|
||||
if(array.length == 1) {
|
||||
panelInsideScrollPane.add(new JSeparator(SwingConstants.VERTICAL));
|
||||
JLabel label = new JLabel(groupName);
|
||||
label.setFont(BIG_FONT);
|
||||
panelInsideScrollPane.add(label);
|
||||
}
|
||||
}
|
||||
if(
|
||||
timeCalcProperty == TimeCalcProperty.VISIBILITY_DEFAULT
|
||||
||
|
||||
timeCalcProperty == TimeCalcProperty.JOKES_VISIBLE
|
||||
) {
|
||||
JLabel label = new JLabel("Misc");
|
||||
label.setFont(BIG_FONT);
|
||||
panelInsideScrollPane.add(label);
|
||||
}
|
||||
}
|
||||
if (p instanceof JColorChooser) {
|
||||
JColorChooser jColorChooser = ((JColorChooser) p);
|
||||
JColorChooser colorChooser = ((JColorChooser) p);
|
||||
//jColorChooser.setMaximumSize(new Dimension(150, 25));
|
||||
|
||||
String timeCalcPropertyKey = (String) jColorChooser.getClientProperty(
|
||||
String timeCalcPropertyKey = (String) colorChooser.getClientProperty(
|
||||
CLIENT_PROPERTY_KEY);
|
||||
TimeCalcProperty timeCalcProperty
|
||||
= TimeCalcProperty.forKey(timeCalcPropertyKey);
|
||||
@ -287,15 +347,16 @@ public class ConfigWindow extends TWindow {
|
||||
int green = Integer.valueOf(currentColorAsStringArray[1]);
|
||||
int blue = Integer.valueOf(currentColorAsStringArray[2]);
|
||||
Color color = new Color(red, green, blue);
|
||||
jColorChooser.setColor(color);
|
||||
jColorChooser.addMouseListener(new MouseListener() {
|
||||
colorChooser.setColor(color);
|
||||
colorChooser.setMaximumSize(new Dimension(200, HEIGHT1));
|
||||
colorChooser.addMouseListener(new MouseListener() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
Color selectedColor = jColorChooser.getSelectionModel()
|
||||
Color selectedColor = colorChooser.getSelectionModel()
|
||||
.getSelectedColor();
|
||||
selectedColor = JColorChooser.showDialog(null, "Choose a color", color);
|
||||
if (selectedColor != null) {
|
||||
jColorChooser.setColor(selectedColor);
|
||||
colorChooser.setColor(selectedColor);
|
||||
((StringProperty) timeCalcConfiguration
|
||||
.getProperty(timeCalcProperty))
|
||||
.setValue(
|
||||
@ -380,15 +441,18 @@ public class ConfigWindow extends TWindow {
|
||||
}
|
||||
});
|
||||
}
|
||||
private static final Font BIG_FONT = new Font("sans", Font.BOLD, 24);
|
||||
private static final String FIVE_SPACES = " ";
|
||||
|
||||
private void addToNextRow(JComponent jComponent) {
|
||||
add(jComponent);
|
||||
jComponent.setBounds(SwingUtils.MARGIN, currentY, WIDTH1,
|
||||
panelInsideScrollPane.add(jComponent);
|
||||
jComponent.setBounds(SwingUtils.MARGIN, currentY, 200,
|
||||
HEIGHT1);
|
||||
panelInsideScrollPane.add(Box.createRigidArea(new Dimension(5, 10)));
|
||||
nextRow();
|
||||
}
|
||||
|
||||
private void nextRow() {
|
||||
currentY = (int) (currentY + 2.5d * SwingUtils.MARGIN);
|
||||
currentY = (int) (currentY + 3.0d * SwingUtils.MARGIN);
|
||||
}
|
||||
}
|
||||
|
@ -182,10 +182,15 @@ public class MainWindow extends TWindow {
|
||||
Jokes.showRandom();
|
||||
}
|
||||
});
|
||||
exitButton.addActionListener(e -> System.exit(0));
|
||||
exitButton.addActionListener(e
|
||||
-> {
|
||||
timeCalcConfiguration.saveToTimeCalcProperties();
|
||||
System.exit(0);
|
||||
});
|
||||
focusButton.addActionListener(e -> requestFocus(true));
|
||||
restartButton.addActionListener(e -> {
|
||||
setVisible(false);
|
||||
timeCalcConfiguration.saveToTimeCalcProperties();
|
||||
stopBeforeEnd = true;
|
||||
});
|
||||
workDaysButton.addActionListener(e -> {
|
||||
@ -206,6 +211,8 @@ public class MainWindow extends TWindow {
|
||||
this.configWindow = new ConfigWindow(timeCalcConfiguration);
|
||||
}
|
||||
configWindow.setVisible(true);
|
||||
configWindow.setLocationRelativeTo(this);
|
||||
configWindow.setLocation(100, 100);
|
||||
});
|
||||
|
||||
helpButton.addActionListener(e -> {
|
||||
@ -253,6 +260,8 @@ public class MainWindow extends TWindow {
|
||||
.bindTo(timeCalcConfiguration.clockHandsSecondVisibleProperty);
|
||||
analogClock.minuteEnabledProperty
|
||||
.bindTo(timeCalcConfiguration.clockHandsMinuteVisibleProperty);
|
||||
analogClock.hourEnabledProperty
|
||||
.bindTo(timeCalcConfiguration.clockHandsHourVisibleProperty);
|
||||
analogClock.handsLongProperty
|
||||
.bindTo(timeCalcConfiguration.clockHandsLongVisibleProperty);
|
||||
analogClock.borderVisibleProperty.bindTo(timeCalcConfiguration.clockBorderVisibleProperty);
|
||||
@ -266,7 +275,8 @@ public class MainWindow extends TWindow {
|
||||
analogClock.centreCircleBlackProperty.bindTo(timeCalcConfiguration.clockCentreCircleBlackProperty);
|
||||
analogClock.progressVisibleOnlyIfMouseMovingOverProperty.bindTo(timeCalcConfiguration.clockProgressVisibleOnlyIfMouseMovingOverProperty);
|
||||
analogClock.dateVisibleOnlyIfMouseMovingOverProperty.bindTo(timeCalcConfiguration.clockDateVisibleOnlyIfMouseMovingOverProperty);
|
||||
|
||||
analogClock.visibleProperty.bindTo(timeCalcConfiguration.clockVisibleProperty);
|
||||
|
||||
MinuteBattery minuteBattery = new MinuteBattery(progressCircle.getBounds().x,
|
||||
progressCircle.getY() + SwingUtils.MARGIN + progressCircle.getHeight(), 140);
|
||||
add(minuteBattery);
|
||||
@ -326,7 +336,12 @@ public class MainWindow extends TWindow {
|
||||
|
||||
ComponentRegistry<TButton> buttonRegistry = new ComponentRegistry();
|
||||
componentRegistry.getSet().stream().filter(c -> c instanceof TButton).forEach(c
|
||||
-> buttonRegistry.add((TButton) c));
|
||||
-> {
|
||||
buttonRegistry.add((TButton) c);
|
||||
|
||||
});
|
||||
// commandButton.visibleProperty.bindTo(timeCalcConfiguration.commandsVisibleProperty);
|
||||
// jokeButton.visibleProperty.bindTo(timeCalcConfiguration.jokesVisibleProperty);
|
||||
componentRegistry.getSet().stream().filter(c
|
||||
-> GetProperty.class.isAssignableFrom(c.getClass())).forEach(c
|
||||
-> {
|
||||
@ -366,6 +381,7 @@ public class MainWindow extends TWindow {
|
||||
);
|
||||
setSize(dayBattery.getX() + dayBattery.getWidth() + 3 * SwingUtils.MARGIN,
|
||||
focusButton.getY() + focusButton.getHeight() + SwingUtils.MARGIN + focusButton.getHeight() + 2 * SwingUtils.MARGIN);
|
||||
|
||||
while (true) {
|
||||
//System.out.println("timeCalcConfiguration.handsLongProperty=" + timeCalcConfiguration.clockHandLongProperty.isEnabled());
|
||||
Visibility currentVisibility = Visibility
|
||||
@ -398,7 +414,9 @@ public class MainWindow extends TWindow {
|
||||
break;
|
||||
}
|
||||
|
||||
componentRegistry.setVisible(c -> c instanceof Widget ? ((Widget)c).visibleProperty.isEnabled() : true, currentVisibility.isNotNone());
|
||||
componentRegistry.setVisible(c -> (c instanceof Widget ? ((Widget)c).visibleProperty.isEnabled()
|
||||
: true) /*|| (c instanceof TButton ? ((Widget)c).visibleProperty.isEnabled()
|
||||
: true)*/, currentVisibility.isNotNone());
|
||||
|
||||
jokeButton.setVisible(
|
||||
TimeCalcProperties.getInstance().getBooleanProperty(
|
||||
@ -547,7 +565,6 @@ public class MainWindow extends TWindow {
|
||||
}
|
||||
|
||||
public void doExit() {
|
||||
timeCalcConfiguration.saveToTimeCalcProperties();
|
||||
exitButton.doClick();
|
||||
}
|
||||
|
||||
@ -556,7 +573,6 @@ public class MainWindow extends TWindow {
|
||||
}
|
||||
|
||||
public void doRestart() {
|
||||
timeCalcConfiguration.saveToTimeCalcProperties();
|
||||
restartButton.doClick();
|
||||
}
|
||||
|
||||
|
@ -27,13 +27,16 @@ public class TButton extends JButton implements GetProperty {
|
||||
= new BooleanProperty("visibilitySupportedColoredProperty", true);
|
||||
private Color originalBackground;
|
||||
private Color originalForeground;
|
||||
|
||||
public final BooleanProperty visibleProperty
|
||||
= new BooleanProperty("visibleProperty", true);
|
||||
|
||||
public TButton(String label) {
|
||||
super(label);
|
||||
new Timer(100, e -> {
|
||||
Visibility visibility
|
||||
= Visibility.valueOf(visibilityProperty.getValue());
|
||||
setVisible(visibility.isNotNone());
|
||||
setVisible(visibility.isNotNone() && visibleProperty.isEnabled());
|
||||
if (!visibility.isStronglyColored() || visibility.isGray()) {
|
||||
setBackground(MainWindow.BACKGROUND_COLOR);
|
||||
setForeground(MainWindow.FOREGROUND_COLOR);
|
||||
|
@ -47,6 +47,8 @@ public class AnalogClock extends Widget {
|
||||
= new IntegerProperty("millisecondProperty");
|
||||
public IntegerProperty dayOfWeekProperty
|
||||
= new IntegerProperty("dayOfWeekProperty");
|
||||
public BooleanProperty hourEnabledProperty
|
||||
= new BooleanProperty("hourEnabledProperty", true);
|
||||
public BooleanProperty minuteEnabledProperty
|
||||
= new BooleanProperty("minuteEnabledProperty", true);
|
||||
public BooleanProperty secondEnabledProperty
|
||||
@ -179,7 +181,7 @@ public class AnalogClock extends Widget {
|
||||
}
|
||||
|
||||
//
|
||||
if (millisecondEnabledProperty.isEnabled() && secondEnabledProperty.isEnabled() && minuteEnabledProperty.isEnabled()) {
|
||||
if (millisecondEnabledProperty.isEnabled() && secondEnabledProperty.isEnabled() && minuteEnabledProperty.isEnabled() && hourEnabledProperty.isEnabled()) {
|
||||
drawHand(g2d, side / 2 - 10, millisecond / 1000.0, 1.0f,
|
||||
COLOR_FOR_MILLISECOND_HAND_STRONGLY_COLORED, visibility);
|
||||
|
||||
@ -192,7 +194,7 @@ public class AnalogClock extends Widget {
|
||||
}
|
||||
}
|
||||
|
||||
if (secondEnabledProperty.isEnabled() && minuteEnabledProperty.isEnabled()) {
|
||||
if (secondEnabledProperty.isEnabled() && minuteEnabledProperty.isEnabled() && hourEnabledProperty.isEnabled()) {
|
||||
drawHand(g2d, side / 2 - 10, second / 60.0, 0.5f, Color.RED,
|
||||
visibility);
|
||||
|
||||
@ -202,7 +204,7 @@ public class AnalogClock extends Widget {
|
||||
Color.RED, visibility);
|
||||
}
|
||||
}
|
||||
if (minuteEnabledProperty.isEnabled()) {
|
||||
if (minuteEnabledProperty.isEnabled() && hourEnabledProperty.isEnabled()) {
|
||||
double minutes = minute / 60.0 + second / 60.0 / 60.0;
|
||||
drawHand(g2d, side / 2 - 20, minutes, 2.0f,
|
||||
Color.BLUE, visibility);
|
||||
@ -214,15 +216,17 @@ public class AnalogClock extends Widget {
|
||||
Color.BLUE, visibility);
|
||||
}
|
||||
}
|
||||
double hours = hour / 12.0 + minute / 60.0 / 12 + second / 60 / 60 / 12;
|
||||
drawHand(g2d, side / 2 - 40,
|
||||
hours, 4.0f,
|
||||
Color.BLACK, visibility);
|
||||
if (handsLongProperty.isEnabled()) {
|
||||
drawHand(g2d, (side / 2 - 40) / 4,
|
||||
hours + hours > 0.5 ? hours - 0.5
|
||||
: hours + (hours > 0.5 ? (-1) : 1) * 0.5, 4.0f,
|
||||
if (hourEnabledProperty.isEnabled()) {
|
||||
double hours = hour / 12.0 + minute / 60.0 / 12 + second / 60 / 60 / 12;
|
||||
drawHand(g2d, side / 2 - 40,
|
||||
hours, 4.0f,
|
||||
Color.BLACK, visibility);
|
||||
if (handsLongProperty.isEnabled()) {
|
||||
drawHand(g2d, (side / 2 - 40) / 4,
|
||||
hours + hours > 0.5 ? hours - 0.5
|
||||
: hours + (hours > 0.5 ? (-1) : 1) * 0.5, 4.0f,
|
||||
Color.BLACK, visibility);
|
||||
}
|
||||
}
|
||||
if (borderVisibleProperty.isEnabled()) {
|
||||
for (int minuteI = 0; minuteI < 60; minuteI++) {
|
||||
|
@ -2,11 +2,8 @@ package org.nanoboot.utils.timecalc.swing.progress;
|
||||
|
||||
import org.nanoboot.utils.timecalc.entity.Visibility;
|
||||
import org.nanoboot.utils.timecalc.swing.common.Widget;
|
||||
import org.nanoboot.utils.timecalc.utils.common.ProgressSmiley;
|
||||
import org.nanoboot.utils.timecalc.utils.common.NumberFormats;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JLabel;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
|
@ -4,6 +4,7 @@ visibility.supported.colored=true
|
||||
clock.visible=true
|
||||
clock.hands.long.visible=true
|
||||
clock.centre-circle.black=false
|
||||
clock.hands.hour.visible=true
|
||||
clock.hands.minute.visible=true
|
||||
clock.hands.second.visible=true
|
||||
clock.hands.millisecond.visible=false
|
||||
|
Loading…
x
Reference in New Issue
Block a user