Added several improvements
This commit is contained in:
parent
fcafe1f3e5
commit
a9333194c7
@ -5,10 +5,7 @@ import org.nanoboot.utils.timecalc.app.TimeCalcProperty;
|
||||
import org.nanoboot.utils.timecalc.entity.Progress;
|
||||
import org.nanoboot.utils.timecalc.entity.Visibility;
|
||||
import org.nanoboot.utils.timecalc.entity.WidgetType;
|
||||
import org.nanoboot.utils.timecalc.swing.progress.ProgressDot;
|
||||
import org.nanoboot.utils.timecalc.swing.progress.ProgressFuelGauge;
|
||||
import org.nanoboot.utils.timecalc.swing.progress.ProgressLife;
|
||||
import org.nanoboot.utils.timecalc.swing.progress.ProgressMoney;
|
||||
import org.nanoboot.utils.timecalc.swing.progress.battery.Battery;
|
||||
import org.nanoboot.utils.timecalc.swing.progress.ProgressSmileyIcon;
|
||||
import org.nanoboot.utils.timecalc.swing.progress.ProgressSwing;
|
||||
@ -35,6 +32,7 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
import javax.swing.JMenuItem;
|
||||
import org.nanoboot.utils.timecalc.app.TimeCalcApp;
|
||||
import static org.nanoboot.utils.timecalc.swing.progress.battery.Battery.HIGH_STRONGLY_COLORED;
|
||||
@ -66,6 +64,7 @@ public class Widget extends JPanel implements
|
||||
126, 179, 227);
|
||||
private static final Color VERY_LIGHT_GRAY = new Color(220, 220, 220);
|
||||
private static final Font FONT = new Font("sans", Font.PLAIN, 12);
|
||||
public static final Color WIDGET_BACKGROUND_COLOR = ((Supplier<Color>) () ->{int i = 232;return new Color(i,i,i);}).get();
|
||||
public final BooleanProperty visibilitySupportedColoredProperty
|
||||
= new BooleanProperty("visibilitySupportedColoredProperty", true);
|
||||
public final BooleanProperty visibleProperty
|
||||
@ -287,6 +286,10 @@ public class Widget extends JPanel implements
|
||||
setVisible(visibleProperty.isEnabled());
|
||||
Visibility visibility
|
||||
= Visibility.valueOf(visibilityProperty.getValue());
|
||||
Color currentColor = brush.getColor();
|
||||
brush.setColor(WIDGET_BACKGROUND_COLOR);
|
||||
brush.fillRect(1, 1, getWidth(), getHeight());
|
||||
brush.setColor(currentColor);
|
||||
|
||||
if (visibleProperty.isDisabled() || hiddenProperty.isEnabled()) {
|
||||
if(hiddenProperty.isEnabled()) {
|
||||
@ -299,7 +302,7 @@ public class Widget extends JPanel implements
|
||||
this.smileyIcon2 = null;
|
||||
}
|
||||
if (mouseOver) {
|
||||
Color currentColor = brush.getColor();
|
||||
currentColor = brush.getColor();
|
||||
brush.setColor(VERY_LIGHT_GRAY);
|
||||
brush.fillRect(1, 1, getWidth() - 2, getHeight() - 2);
|
||||
brush.setColor(currentColor);
|
||||
@ -338,7 +341,7 @@ public class Widget extends JPanel implements
|
||||
paintMinimizeIcon(brush, getWidth(), mouseOver, mouseOverMinimizeButton);
|
||||
|
||||
if (mouseOver) {
|
||||
Color currentColor = brush.getColor();
|
||||
currentColor = brush.getColor();
|
||||
if(visibility.isStronglyColored()) {
|
||||
brush.setColor(Color.BLUE);
|
||||
}
|
||||
|
@ -397,7 +397,7 @@ public class Battery extends Widget {
|
||||
|
||||
@Override
|
||||
public void setBounds(int x, int y, int height) {
|
||||
setBounds(x, y, (int) (40d / 100d * ((double) height)), height);
|
||||
setBounds(x, y, (int) (50d / 100d * ((double) height)), height);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -174,7 +174,7 @@ public class ProgressWeather extends Widget implements GetProperty {
|
||||
sb
|
||||
.append("Maximum: ")
|
||||
.append(NumberFormats.FORMATTER_ONE_DECIMAL_PLACE.format(wf.getMaximumCelsius()))
|
||||
.append(" °C at ").append(TTime.ofMilliseconds((int) (wf.getMinimumCelsiusTime() * 1000d * 60d * 60d)).toString().substring(0, 5))
|
||||
.append(" °C at ").append(TTime.ofMilliseconds((int) (wf.getMaximumCelsiusTime() * 1000d * 60d * 60d)).toString().substring(0, 5))
|
||||
.append("\n");
|
||||
sb
|
||||
.append("End: ")
|
||||
|
@ -91,7 +91,7 @@ public class MainWindow extends TWindow {
|
||||
public static final Color BACKGROUND_COLOR = new Color(238, 238, 238);
|
||||
public static final Color FOREGROUND_COLOR = new Color(210, 210, 210);
|
||||
public static final JCheckBox hideShowFormsCheckBox = new JCheckBox();
|
||||
private static final int BATTERY_WIDTH = 140;
|
||||
private static final int BATTERY_HEIGHT = 120;
|
||||
private static final String BACKUP = "_backup";
|
||||
private static final String BASIC_FEATURE__ = "__only_basic_features__";
|
||||
private static final String DASH = "-";
|
||||
@ -318,43 +318,43 @@ public class MainWindow extends TWindow {
|
||||
|
||||
MinuteBattery minuteBattery
|
||||
= new MinuteBattery(clock.getBounds().x + clock.getWidth() + SwingUtils.MARGIN,
|
||||
clock.getY(), BATTERY_WIDTH);
|
||||
clock.getY(), BATTERY_HEIGHT);
|
||||
add(minuteBattery);
|
||||
Battery hourBattery = new HourBattery(
|
||||
minuteBattery.getBounds().x + minuteBattery.getWidth()
|
||||
+ SwingUtils.MARGIN,
|
||||
minuteBattery.getY(),
|
||||
BATTERY_WIDTH);
|
||||
BATTERY_HEIGHT);
|
||||
add(hourBattery);
|
||||
|
||||
Battery dayBattery = new DayBattery(
|
||||
hourBattery.getBounds().x + hourBattery.getWidth()
|
||||
+ SwingUtils.MARGIN,
|
||||
hourBattery.getY(),
|
||||
BATTERY_WIDTH);
|
||||
BATTERY_HEIGHT);
|
||||
add(dayBattery);
|
||||
|
||||
Battery weekBattery = new WeekBattery(
|
||||
dayBattery.getBounds().x + dayBattery.getWidth() + SwingUtils.MARGIN,
|
||||
dayBattery.getY(),
|
||||
BATTERY_WIDTH);
|
||||
BATTERY_HEIGHT);
|
||||
add(weekBattery);
|
||||
|
||||
Battery monthBattery = new MonthBattery(
|
||||
weekBattery.getBounds().x + weekBattery.getWidth()
|
||||
+ SwingUtils.MARGIN,
|
||||
weekBattery.getY(), BATTERY_WIDTH);
|
||||
weekBattery.getY(), BATTERY_HEIGHT);
|
||||
add(monthBattery);
|
||||
Battery yearBattery = new YearBattery(
|
||||
monthBattery.getBounds().x + monthBattery.getWidth()
|
||||
+ SwingUtils.MARGIN,
|
||||
monthBattery.getY(), BATTERY_WIDTH);
|
||||
monthBattery.getY(), BATTERY_HEIGHT);
|
||||
add(yearBattery);
|
||||
|
||||
WalkingHumanProgress walkingHumanProgress
|
||||
= new WalkingHumanProgress();
|
||||
walkingHumanProgress.setBounds(minuteBattery.getX(),
|
||||
minuteBattery.getY() + minuteBattery.getHeight(), 400, 80);
|
||||
minuteBattery.getY() + minuteBattery.getHeight() + SwingUtils.MARGIN, 400, 80);
|
||||
add(walkingHumanProgress);
|
||||
walkingHumanProgress.visibleProperty
|
||||
.bindTo(timeCalcConfiguration.walkingHumanVisibleProperty);
|
||||
@ -365,7 +365,7 @@ public class MainWindow extends TWindow {
|
||||
//
|
||||
ProgressSquare progressSquare = new ProgressSquare();
|
||||
progressSquare
|
||||
.setBounds(yearBattery.getX() + yearBattery.getWidth() + 4 * SwingUtils.MARGIN, yearBattery.getY(),
|
||||
.setBounds(yearBattery.getX() + yearBattery.getWidth() + SwingUtils.MARGIN, yearBattery.getY(),
|
||||
100);
|
||||
add(progressSquare);
|
||||
progressSquare.visibleProperty
|
||||
@ -871,7 +871,7 @@ public class MainWindow extends TWindow {
|
||||
}
|
||||
);
|
||||
setSize(progressSquare.getX() + progressSquare.getWidth()
|
||||
+ 3 * SwingUtils.MARGIN,
|
||||
+ 4 * SwingUtils.MARGIN,
|
||||
focusButton.getY() + focusButton.getHeight() + SwingUtils.MARGIN
|
||||
+ focusButton.getHeight() + 2 * SwingUtils.MARGIN);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user