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