Added new improvements

This commit is contained in:
Robert Vokac 2024-02-04 12:06:08 +00:00
parent a03260033f
commit c18da0c12c
No known key found for this signature in database
GPG Key ID: 693D30BEE3329055
4 changed files with 4 additions and 27 deletions

View File

@ -43,9 +43,6 @@ If file overtime.txt does not exist, then the default overtime is 0:00.
### test.txt ### 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. 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 ## Key shortcuts
## Command button ## Command button

View File

@ -59,7 +59,6 @@ public class Battery extends Widget {
} }
if(donePercent > 0 && donePercent < CRITICAL_LOW_ENERGY && (System.nanoTime() - tmpNanoTime) > (500000000l) / 2l) { if(donePercent > 0 && donePercent < CRITICAL_LOW_ENERGY && (System.nanoTime() - tmpNanoTime) > (500000000l) / 2l) {
blinking.flip(); blinking.flip();
System.out.println(getName() + "donePercent=" + donePercent);
tmpNanoTime = System.nanoTime(); tmpNanoTime = System.nanoTime();
} }
if(donePercent <= 0 && blinking.get()){ if(donePercent <= 0 && blinking.get()){

View File

@ -32,8 +32,6 @@ import java.time.LocalDateTime;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import static org.nanoboot.utils.timecalc.utils.FileConstants.FOCUS_TXT;
/** /**
* @author pc00289 * @author pc00289
* @since 08.02.2024 * @since 08.02.2024
@ -73,7 +71,6 @@ public class TimeCalcManager {
TimeCalcWindow window = new TimeCalcWindow(); TimeCalcWindow window = new TimeCalcWindow();
TimeCalcButton focusButton = new TimeCalcButton("Focus");
TimeCalcButton commandButton = new TimeCalcButton("Command"); TimeCalcButton commandButton = new TimeCalcButton("Command");
TimeCalcButton weatherButton = new TimeCalcButton("Weather"); TimeCalcButton weatherButton = new TimeCalcButton("Weather");
TimeCalcButton jokeButton = new TimeCalcButton("Joke"); TimeCalcButton jokeButton = new TimeCalcButton("Joke");
@ -82,7 +79,7 @@ public class TimeCalcManager {
AboutButton aboutButton = new AboutButton(); AboutButton aboutButton = new AboutButton();
//window.add(weatherButton); //window.add(weatherButton);
window.addAll(commandButton, focusButton, jokeButton, restartButton, window.addAll(commandButton, jokeButton, restartButton,
exitButton); exitButton);
window.addKeyListener(new KeyAdapter() { window.addKeyListener(new KeyAdapter() {
// Key Pressed method // Key Pressed method
@ -129,10 +126,6 @@ public class TimeCalcManager {
aboutButton.setBounds(exitButton.getX(), aboutButton.setBounds(exitButton.getX(),
exitButton.getY() + exitButton.getHeight() + MARGIN); exitButton.getY() + exitButton.getHeight() + MARGIN);
focusButton.setBounds(
exitButton.getX() + 2 * MARGIN + exitButton.getWidth() + 20,
exitButton.getY(), 80, aboutButton.getHeight());
window.setLayout(null); window.setLayout(null);
window.setVisible(true); window.setVisible(true);
@ -197,9 +190,6 @@ public class TimeCalcManager {
} }
}); });
focusButton.addActionListener(e -> {
window.requestFocus();
});
jokeButton.addActionListener(e -> { jokeButton.addActionListener(e -> {
for (int i = 1; i <= 1; i++) { for (int i = 1; i <= 1; i++) {
Jokes.showRandom(); Jokes.showRandom();
@ -295,25 +285,21 @@ public class TimeCalcManager {
monthBattery, monthBattery,
hourBattery, hourBattery,
jokeButton, jokeButton,
focusButton,
commandButton, commandButton,
restartButton, restartButton,
exitButton exitButton
); );
window.setSize(520 + 20 + 100, exitButton.getY() + 3 * exitButton.getHeight() + MARGIN); window.setSize(520 + 20 + 100, exitButton.getY() + 3 * exitButton.getHeight() + MARGIN);
while (true) { while (true) {
if(Math.random() > 0.95) {
window.requestFocus();
}
if (stopBeforeEnd) { if (stopBeforeEnd) {
window.setVisible(false); window.setVisible(false);
window.dispose(); window.dispose();
break; break;
} }
if (Math.random() > 0.9) {
if (FOCUS_TXT.exists()) {
window.requestFocus();
FOCUS_TXT.delete();
}
}
if (Utils.highlighted.get()) { if (Utils.highlighted.get()) {
Utils.ultraLight.set(false); Utils.ultraLight.set(false);
} }
@ -321,25 +307,21 @@ public class TimeCalcManager {
componentRegistry.setVisible(!Utils.everythingHidden.get()); componentRegistry.setVisible(!Utils.everythingHidden.get());
if (!Utils.highlighted.get() || Utils.ultraLight.get()) { if (!Utils.highlighted.get() || Utils.ultraLight.get()) {
jokeButton.setBackground(BG); jokeButton.setBackground(BG);
focusButton.setBackground(BG);
commandButton.setBackground(BG); commandButton.setBackground(BG);
restartButton.setBackground(BG); restartButton.setBackground(BG);
exitButton.setBackground(BG); exitButton.setBackground(BG);
jokeButton.setForeground(FG); jokeButton.setForeground(FG);
focusButton.setForeground(FG);
commandButton.setForeground(FG); commandButton.setForeground(FG);
restartButton.setForeground(FG); restartButton.setForeground(FG);
exitButton.setForeground(FG); exitButton.setForeground(FG);
} else { } else {
jokeButton.setOriginalBackground(); jokeButton.setOriginalBackground();
focusButton.setOriginalBackground();
commandButton.setOriginalBackground(); commandButton.setOriginalBackground();
restartButton.setOriginalBackground(); restartButton.setOriginalBackground();
exitButton.setOriginalBackground(); exitButton.setOriginalBackground();
// //
jokeButton.setOriginalForeground(); jokeButton.setOriginalForeground();
focusButton.setOriginalForeground();
commandButton.setOriginalForeground(); commandButton.setOriginalForeground();
restartButton.setOriginalForeground(); restartButton.setOriginalForeground();
exitButton.setOriginalForeground(); exitButton.setOriginalForeground();

View File

@ -13,5 +13,4 @@ public class FileConstants {
public static final File STARTTIME_TXT = new File("starttime.txt"); public static final File STARTTIME_TXT = new File("starttime.txt");
public static final File OVERTIME_TXT = new File("overtime.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 TEST_TXT = new File("test.txt");
public static final File FOCUS_TXT = new File("focus.txt");
} }