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
ac07b43358
commit
5f7826b9e0
@ -2,6 +2,7 @@ package org.nanoboot.utils.timecalc.gui.progress;
|
|||||||
|
|
||||||
import org.nanoboot.utils.timecalc.gui.common.Widget;
|
import org.nanoboot.utils.timecalc.gui.common.Widget;
|
||||||
import org.nanoboot.utils.timecalc.main.TimeCalcConf;
|
import org.nanoboot.utils.timecalc.main.TimeCalcConf;
|
||||||
|
import org.nanoboot.utils.timecalc.utils.DateFormats;
|
||||||
import org.nanoboot.utils.timecalc.utils.Utils;
|
import org.nanoboot.utils.timecalc.utils.Utils;
|
||||||
|
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
@ -120,18 +121,20 @@ public class AnalogClock extends Widget {
|
|||||||
|
|
||||||
// g2d.drawOval(3, 3, centerX * 2 - 6, centerY * 2 - 6);
|
// g2d.drawOval(3, 3, centerX * 2 - 6, centerY * 2 - 6);
|
||||||
// g2d.drawOval(4, 4, centerX * 2 - 8, centerY * 2 - 8);
|
// g2d.drawOval(4, 4, centerX * 2 - 8, centerY * 2 - 8);
|
||||||
|
if(this.mouseOver)
|
||||||
|
{
|
||||||
|
|
||||||
DateFormat formatter2 =
|
g2d.drawString(DateFormats.DATE_TIME_FORMATTER_LONG.format(new Date()), ((int) (side * 0.25)),
|
||||||
new SimpleDateFormat("HH:mm:ss", Locale.ENGLISH);
|
((int) (side * 0.35)));
|
||||||
String now = formatter2.format(new Date());
|
g2d.drawString(DateFormats.DATE_TIME_FORMATTER_TIME.format(new Date()),
|
||||||
|
((int) (side * 0.25) + 30),
|
||||||
|
((int) (side * 0.35)) + 60);
|
||||||
|
}
|
||||||
for (int i = 1; i <= 12; i++) {
|
for (int i = 1; i <= 12; i++) {
|
||||||
double angle = Math.PI * 2 * (i / 12.0 - 0.25);
|
double angle = Math.PI * 2 * (i / 12.0 - 0.25);
|
||||||
int dx = centerX + (int) ((radius + 20) * Math.cos(angle)) - 4;
|
int dx = centerX + (int) ((radius + 20) * Math.cos(angle)) - 4;
|
||||||
int dy = centerY + (int) ((radius + 20) * Math.sin(angle)) + 4;
|
int dy = centerY + (int) ((radius + 20) * Math.sin(angle)) + 4;
|
||||||
|
|
||||||
int seconds = Integer.valueOf(now.split(":")[2]);
|
|
||||||
|
|
||||||
g2d.setFont(new Font("sans", Font.BOLD, 16));
|
g2d.setFont(new Font("sans", Font.BOLD, 16));
|
||||||
g2d.drawString(Integer.toString(i), dx, dy);
|
g2d.drawString(Integer.toString(i), dx, dy);
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,6 @@ import java.awt.event.KeyEvent;
|
|||||||
import java.time.DayOfWeek;
|
import java.time.DayOfWeek;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.Month;
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
package org.nanoboot.utils.timecalc.utils;
|
package org.nanoboot.utils.timecalc.utils;
|
||||||
|
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Robert
|
* @author Robert
|
||||||
@ -12,4 +15,9 @@ public class DateFormats {
|
|||||||
}
|
}
|
||||||
public final static DateTimeFormatter DATE_TIME_FORMATTER_HHmmssSSS =
|
public final static DateTimeFormatter DATE_TIME_FORMATTER_HHmmssSSS =
|
||||||
DateTimeFormatter.ofPattern("HH:mm:ss:SSS");
|
DateTimeFormatter.ofPattern("HH:mm:ss:SSS");
|
||||||
|
public static DateFormat DATE_TIME_FORMATTER_LONG =
|
||||||
|
new SimpleDateFormat("EEEE : yyyy-MM-dd", Locale.ENGLISH);
|
||||||
|
//
|
||||||
|
public static DateFormat DATE_TIME_FORMATTER_TIME =
|
||||||
|
new SimpleDateFormat("HH:mm:ss", Locale.ENGLISH);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user