Added some improvements
This commit is contained in:
parent
5291779733
commit
db1c0764dd
@ -56,7 +56,7 @@ Configuration for a profile is stored here.
|
||||
|
||||
Current profile is stored here.
|
||||
|
||||
### time-calc-profiles.txt
|
||||
### ./tc/time-calc-profiles.txt
|
||||
|
||||
Optional assignments of profiles to numbers is stored here.
|
||||
|
||||
|
@ -25,8 +25,28 @@ public class SwingUtils {
|
||||
//Not meant to be instantiated.
|
||||
}
|
||||
|
||||
public static void paintCloseIcon(Graphics brush, int width) {
|
||||
brush.setColor(SwingUtils.CLOSE_BUTTON_BACKGROUND_COLOR);
|
||||
public static void paintCloseIcon(Graphics brush, int width,
|
||||
boolean mouseOver, boolean mouseOverCloseButton) {
|
||||
|
||||
if(!mouseOver) {
|
||||
//nothing to do
|
||||
return;
|
||||
}
|
||||
if(!mouseOverCloseButton) {
|
||||
//nothing to do
|
||||
return;
|
||||
}
|
||||
|
||||
brush.setColor(SwingUtils.CLOSE_BUTTON_BACKGROUND_COLOR);
|
||||
|
||||
// if(!mouseOverCloseButton) {
|
||||
// brush.drawRect(width - CLOSE_BUTTON_SIDE - 1, 0 + 1, CLOSE_BUTTON_SIDE,
|
||||
// CLOSE_BUTTON_SIDE);
|
||||
// brush.drawRect(width - CLOSE_BUTTON_SIDE - 1+1, 0 + 1 +1, CLOSE_BUTTON_SIDE - 2,
|
||||
// CLOSE_BUTTON_SIDE - 2);
|
||||
// return;
|
||||
// }
|
||||
|
||||
brush.fillOval(width - CLOSE_BUTTON_SIDE - 1, 0 + 1, CLOSE_BUTTON_SIDE,
|
||||
CLOSE_BUTTON_SIDE);
|
||||
brush.setColor(Color.LIGHT_GRAY);
|
||||
|
@ -9,7 +9,7 @@ import java.time.LocalDate;
|
||||
import java.util.Calendar;
|
||||
|
||||
/**
|
||||
* @author Robert
|
||||
* @author Robert Vokac
|
||||
* @since 06.03.2024
|
||||
*/
|
||||
@Getter
|
||||
|
@ -19,6 +19,7 @@ public class FileConstants {
|
||||
new File(TC_DIRECTORY, "time-calc-current-profile.txt");
|
||||
public static final File FILE_WITHOUT_ANY_PROFILE =
|
||||
new File(TC_DIRECTORY, "timecalc.conf");
|
||||
public static final File JOKES_TXT = new File(TC_DIRECTORY, "jokes.txt");
|
||||
|
||||
private FileConstants() {
|
||||
//Not meant to be instantiated.
|
||||
|
@ -33,7 +33,8 @@ public class Jokes {
|
||||
static {
|
||||
try {
|
||||
array = JokesTxt.getAsArray();
|
||||
Set<String> set = new HashSet<>();
|
||||
if(array.length > 0) {
|
||||
Set<String> set = new HashSet<>();
|
||||
for (String vtip : array) {
|
||||
if (vtip.trim().isEmpty()) {
|
||||
//nothing to do
|
||||
@ -43,6 +44,8 @@ public class Jokes {
|
||||
}
|
||||
array = new String[set.size()];
|
||||
array = set.toArray(array);
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
System.err.println(e);
|
||||
}
|
||||
@ -63,7 +66,7 @@ public class Jokes {
|
||||
}
|
||||
|
||||
public static void showRandom() {
|
||||
if (!TimeCalcProperties.getInstance().getBooleanProperty(
|
||||
if (array.length == 0 || !TimeCalcProperties.getInstance().getBooleanProperty(
|
||||
TimeCalcProperty.JOKES_VISIBLE)) {
|
||||
//nothing to do
|
||||
return;
|
||||
|
@ -14,10 +14,10 @@ public class JokesTxt {
|
||||
}
|
||||
|
||||
public static String[] getAsArray() throws IOException {
|
||||
File jokeTxtFile = new File("jokes.txt");
|
||||
File jokeTxtFile = FileConstants.JOKES_TXT;
|
||||
if (!jokeTxtFile.exists()) {
|
||||
//nothing to do
|
||||
return new String[] {"A", "B", "C"};
|
||||
return new String[] {};
|
||||
}
|
||||
return Utils.readTextFromFile(jokeTxtFile).split("-----SEPARATOR-----");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user