Added new improvements

This commit is contained in:
Robert Vokac 2024-02-04 10:31:42 +00:00
parent e37fc57742
commit dc9c3ca3b0
No known key found for this signature in database
GPG Key ID: 693D30BEE3329055
2 changed files with 41 additions and 0 deletions

View File

@ -1,6 +1,8 @@
package org.nanoboot.utils.timecalc.gui.common;
import javax.swing.JButton;
import javax.swing.Timer;
import java.awt.Color;
/**
* @author Robert
@ -9,6 +11,8 @@ import javax.swing.JButton;
public class TimeCalcButton extends JButton {
private static final int BUTTON_WIDTH = 100;
private static final int BUTTON_HEIGHT = 30;
private Color originalBackground;
private Color originalForeground;
public TimeCalcButton(String label) {
super(label);
@ -16,5 +20,15 @@ public class TimeCalcButton extends JButton {
public void setBounds(int x, int y) {
setBounds(x, y, BUTTON_WIDTH, BUTTON_HEIGHT);
this.originalBackground = getBackground();
this.originalForeground = getForeground();
new Timer(100, e -> repaint()).start();
}
public void setOriginalBackground() {
this.setBackground(originalBackground);;
}
public void setOriginalForeground() {
this.setForeground(originalForeground);;
}
}

View File

@ -40,6 +40,8 @@ import static org.nanoboot.utils.timecalc.utils.FileConstants.FOCUS_TXT;
*/
public class TimeCalcManager {
private static final int MARGIN = 10;
public static final Color BG = new Color(238, 238, 238);
public static final Color FG = new Color(210, 210, 210);
private final String windowTitle;
private final int totalMinutes;
@ -318,6 +320,31 @@ public class TimeCalcManager {
}
componentRegistry.setVisible(!Utils.everythingHidden.get());
if (!Utils.highlighted.get() || Utils.ultraLight.get()) {
jokeButton.setBackground(BG);
focusButton.setBackground(BG);
commandButton.setBackground(BG);
restartButton.setBackground(BG);
exitButton.setBackground(BG);
jokeButton.setForeground(FG);
focusButton.setForeground(FG);
commandButton.setForeground(FG);
restartButton.setForeground(FG);
exitButton.setForeground(FG);
} else {
jokeButton.setOriginalBackground();
focusButton.setOriginalBackground();
commandButton.setOriginalBackground();
restartButton.setOriginalBackground();
exitButton.setOriginalBackground();
//
jokeButton.setOriginalForeground();
focusButton.setOriginalForeground();
commandButton.setOriginalForeground();
restartButton.setOriginalForeground();
exitButton.setOriginalForeground();
}
jokeButton.setVisible(
TimeCalcConf.getInstance().isJokeVisible()
&& !Utils.everythingHidden.get());