mirror of
https://github.com/robertvokac/time-calc.git
synced 2025-03-25 07:27:49 +01:00
Added new improvements
This commit is contained in:
parent
8ce49c669e
commit
e37fc57742
@ -27,7 +27,7 @@ public class WalkingHumanProgressAsciiArt extends JTextPane {
|
|||||||
private final Set<Integer> alreadyShownPercents = new HashSet<>();
|
private final Set<Integer> alreadyShownPercents = new HashSet<>();
|
||||||
private static final String WALL = "||";
|
private static final String WALL = "||";
|
||||||
public WalkingHumanProgressAsciiArt() {
|
public WalkingHumanProgressAsciiArt() {
|
||||||
setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12));
|
setFont(new Font(Font.MONOSPACED, Font.PLAIN, 11));
|
||||||
putClientProperty("mouseEntered", "false");
|
putClientProperty("mouseEntered", "false");
|
||||||
setFocusable(false);
|
setFocusable(false);
|
||||||
setForeground(Color.GRAY);
|
setForeground(Color.GRAY);
|
||||||
@ -99,7 +99,7 @@ public class WalkingHumanProgressAsciiArt extends JTextPane {
|
|||||||
|
|
||||||
sb.append("\n" + msg + "\n\n");
|
sb.append("\n" + msg + "\n\n");
|
||||||
|
|
||||||
int spacesTotal = 48;
|
int spacesTotal = 40;
|
||||||
int spacesDone = (int) (percent * spacesTotal);
|
int spacesDone = (int) (percent * spacesTotal);
|
||||||
if (spacesDone > spacesTotal) {
|
if (spacesDone > spacesTotal) {
|
||||||
spacesDone = spacesTotal;
|
spacesDone = spacesTotal;
|
||||||
@ -125,8 +125,8 @@ public class WalkingHumanProgressAsciiArt extends JTextPane {
|
|||||||
spacesTodo) + (spacesTodo == 0 ?
|
spacesTodo) + (spacesTodo == 0 ?
|
||||||
" /☼☼☼☼\\ " :
|
" /☼☼☼☼\\ " :
|
||||||
"| |") + Constants.NEW_LINE +
|
"| |") + Constants.NEW_LINE +
|
||||||
"================================================================"
|
createRepeatedString(spacesTotal + 16, '=') +
|
||||||
+ Constants.NEW_LINE + "Steps: " + NumberFormats.FORMATTER_FIVE_DECIMAL_PLACES
|
Constants.NEW_LINE + "Steps: " + NumberFormats.FORMATTER_FIVE_DECIMAL_PLACES
|
||||||
.format(percent * ((double) spacesTotal)) + "/"
|
.format(percent * ((double) spacesTotal)) + "/"
|
||||||
+ spacesTotal
|
+ spacesTotal
|
||||||
);
|
);
|
||||||
|
@ -71,7 +71,7 @@ public class TimeCalcManager {
|
|||||||
|
|
||||||
TimeCalcWindow window = new TimeCalcWindow();
|
TimeCalcWindow window = new TimeCalcWindow();
|
||||||
|
|
||||||
TimeCalcButton focusButton = new TimeCalcButton("F");
|
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");
|
||||||
@ -113,7 +113,7 @@ public class TimeCalcManager {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
WalkingHumanProgressAsciiArt walkingHumanProgressAsciiArt = new WalkingHumanProgressAsciiArt();
|
WalkingHumanProgressAsciiArt walkingHumanProgressAsciiArt = new WalkingHumanProgressAsciiArt();
|
||||||
walkingHumanProgressAsciiArt.setBounds(MARGIN, MARGIN + 210 + MARGIN, 500, 250);
|
walkingHumanProgressAsciiArt.setBounds(MARGIN, MARGIN + 210 + MARGIN, 450, 180);
|
||||||
|
|
||||||
window.add(walkingHumanProgressAsciiArt);
|
window.add(walkingHumanProgressAsciiArt);
|
||||||
weatherButton
|
weatherButton
|
||||||
@ -128,8 +128,8 @@ public class TimeCalcManager {
|
|||||||
exitButton.getY() + exitButton.getHeight() + MARGIN);
|
exitButton.getY() + exitButton.getHeight() + MARGIN);
|
||||||
|
|
||||||
focusButton.setBounds(
|
focusButton.setBounds(
|
||||||
exitButton.getX() + 3 * MARGIN + exitButton.getWidth() + 20,
|
exitButton.getX() + 2 * MARGIN + exitButton.getWidth() + 20,
|
||||||
MARGIN, 60, aboutButton.getHeight());
|
exitButton.getY(), 80, aboutButton.getHeight());
|
||||||
|
|
||||||
window.setSize(520 + 20 + 100, 580 + MARGIN + aboutButton.getHeight());
|
window.setSize(520 + 20 + 100, 580 + MARGIN + aboutButton.getHeight());
|
||||||
window.setLayout(null);
|
window.setLayout(null);
|
||||||
@ -274,17 +274,14 @@ public class TimeCalcManager {
|
|||||||
Battery hourBattery = new HourBattery(monthBattery.getBounds().x,
|
Battery hourBattery = new HourBattery(monthBattery.getBounds().x,
|
||||||
monthBattery.getY() + monthBattery.getHeight() + MARGIN, 140);
|
monthBattery.getY() + monthBattery.getHeight() + MARGIN, 140);
|
||||||
window.add(hourBattery);
|
window.add(hourBattery);
|
||||||
Rectangle hourRectangle = hourBattery.getBounds();
|
|
||||||
Rectangle dayRectangle = dayBattery.getBounds();
|
Rectangle dayRectangle = dayBattery.getBounds();
|
||||||
Rectangle weekRectangle = weekBattery.getBounds();
|
|
||||||
Rectangle monthRectangle = monthBattery.getBounds();
|
|
||||||
hourBattery.setBounds(dayRectangle);
|
hourBattery.setBounds(dayRectangle);
|
||||||
dayBattery.setBounds(weekRectangle);
|
hourBattery.setBounds(hourBattery.getX() + 2 * MARGIN, hourBattery.getY(), hourBattery.getWidth(), hourBattery.getHeight());
|
||||||
weekBattery.setBounds(monthRectangle);
|
dayBattery.setBounds(hourBattery.getX() + hourBattery.getWidth() + MARGIN, hourBattery.getY(), hourBattery.getWidth(), hourBattery.getHeight());
|
||||||
monthBattery.setBounds(hourRectangle);
|
weekBattery.setBounds(hourBattery.getX(), hourBattery.getY() + hourBattery.getHeight() + MARGIN, hourBattery.getWidth(), hourBattery.getHeight());
|
||||||
//
|
monthBattery.setBounds(hourBattery.getX() + hourBattery.getWidth() + MARGIN, hourBattery.getY() + hourBattery.getHeight() + MARGIN, hourBattery.getWidth(), hourBattery.getHeight());
|
||||||
weekBattery.setBounds(dayBattery.getX(), weekBattery.getY(), weekBattery.getWidth(), weekBattery.getHeight());
|
|
||||||
monthBattery.setBounds(dayBattery.getX(), monthBattery.getY(), monthBattery.getWidth(), monthBattery.getHeight());
|
|
||||||
|
|
||||||
ComponentRegistry componentRegistry = new ComponentRegistry();
|
ComponentRegistry componentRegistry = new ComponentRegistry();
|
||||||
componentRegistry.addAll(
|
componentRegistry.addAll(
|
||||||
@ -302,6 +299,7 @@ public class TimeCalcManager {
|
|||||||
restartButton,
|
restartButton,
|
||||||
exitButton
|
exitButton
|
||||||
);
|
);
|
||||||
|
window.setSize(window.getWidth(), exitButton.getY() + 3 * exitButton.getHeight() + MARGIN);
|
||||||
while (true) {
|
while (true) {
|
||||||
if (stopBeforeEnd) {
|
if (stopBeforeEnd) {
|
||||||
window.setVisible(false);
|
window.setVisible(false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user