diff --git a/Readme.md b/Readme.md index 91522a6..d9422ad 100644 --- a/Readme.md +++ b/Readme.md @@ -43,9 +43,6 @@ If file overtime.txt does not exist, then the default overtime is 0:00. ### test.txt If file test.txt exists, then user is not asked for start time and overtime. Instead, the values in files starttime.txt and overtime.txt are used. -### focus.txt -Requests focus for the window. - ## Key shortcuts ## Command button diff --git a/src/main/java/org/nanoboot/utils/timecalc/gui/progress/Battery.java b/src/main/java/org/nanoboot/utils/timecalc/gui/progress/Battery.java index edf04d6..b7d45a9 100644 --- a/src/main/java/org/nanoboot/utils/timecalc/gui/progress/Battery.java +++ b/src/main/java/org/nanoboot/utils/timecalc/gui/progress/Battery.java @@ -59,7 +59,6 @@ public class Battery extends Widget { } if(donePercent > 0 && donePercent < CRITICAL_LOW_ENERGY && (System.nanoTime() - tmpNanoTime) > (500000000l) / 2l) { blinking.flip(); - System.out.println(getName() + "donePercent=" + donePercent); tmpNanoTime = System.nanoTime(); } if(donePercent <= 0 && blinking.get()){ diff --git a/src/main/java/org/nanoboot/utils/timecalc/main/TimeCalcManager.java b/src/main/java/org/nanoboot/utils/timecalc/main/TimeCalcManager.java index ed1de67..3af1acb 100644 --- a/src/main/java/org/nanoboot/utils/timecalc/main/TimeCalcManager.java +++ b/src/main/java/org/nanoboot/utils/timecalc/main/TimeCalcManager.java @@ -32,8 +32,6 @@ import java.time.LocalDateTime; import java.util.Calendar; import java.util.Date; -import static org.nanoboot.utils.timecalc.utils.FileConstants.FOCUS_TXT; - /** * @author pc00289 * @since 08.02.2024 @@ -73,7 +71,6 @@ public class TimeCalcManager { TimeCalcWindow window = new TimeCalcWindow(); - TimeCalcButton focusButton = new TimeCalcButton("Focus"); TimeCalcButton commandButton = new TimeCalcButton("Command"); TimeCalcButton weatherButton = new TimeCalcButton("Weather"); TimeCalcButton jokeButton = new TimeCalcButton("Joke"); @@ -82,7 +79,7 @@ public class TimeCalcManager { AboutButton aboutButton = new AboutButton(); //window.add(weatherButton); - window.addAll(commandButton, focusButton, jokeButton, restartButton, + window.addAll(commandButton, jokeButton, restartButton, exitButton); window.addKeyListener(new KeyAdapter() { // Key Pressed method @@ -129,10 +126,6 @@ public class TimeCalcManager { aboutButton.setBounds(exitButton.getX(), exitButton.getY() + exitButton.getHeight() + MARGIN); - focusButton.setBounds( - exitButton.getX() + 2 * MARGIN + exitButton.getWidth() + 20, - exitButton.getY(), 80, aboutButton.getHeight()); - window.setLayout(null); window.setVisible(true); @@ -197,9 +190,6 @@ public class TimeCalcManager { } }); - focusButton.addActionListener(e -> { - window.requestFocus(); - }); jokeButton.addActionListener(e -> { for (int i = 1; i <= 1; i++) { Jokes.showRandom(); @@ -295,25 +285,21 @@ public class TimeCalcManager { monthBattery, hourBattery, jokeButton, - focusButton, commandButton, restartButton, exitButton ); window.setSize(520 + 20 + 100, exitButton.getY() + 3 * exitButton.getHeight() + MARGIN); while (true) { + if(Math.random() > 0.95) { + window.requestFocus(); + } if (stopBeforeEnd) { window.setVisible(false); window.dispose(); break; } - if (Math.random() > 0.9) { - if (FOCUS_TXT.exists()) { - window.requestFocus(); - FOCUS_TXT.delete(); - } - } if (Utils.highlighted.get()) { Utils.ultraLight.set(false); } @@ -321,25 +307,21 @@ 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(); diff --git a/src/main/java/org/nanoboot/utils/timecalc/utils/FileConstants.java b/src/main/java/org/nanoboot/utils/timecalc/utils/FileConstants.java index 85c4cd2..ab199fc 100644 --- a/src/main/java/org/nanoboot/utils/timecalc/utils/FileConstants.java +++ b/src/main/java/org/nanoboot/utils/timecalc/utils/FileConstants.java @@ -13,5 +13,4 @@ public class FileConstants { public static final File STARTTIME_TXT = new File("starttime.txt"); public static final File OVERTIME_TXT = new File("overtime.txt"); public static final File TEST_TXT = new File("test.txt"); - public static final File FOCUS_TXT = new File("focus.txt"); }