MCPcopy Create free account
hub / github.com/dumbledore/AlbiteREADER / drawClock

Method drawClock

src/org/albite/albite/BookCanvas.java:630–664  ·  view source on GitHub ↗
(final int w, final int h, final Graphics g)

Source from the content-addressed store, hash-verified

628 }
629
630 private void drawClock(final int w, final int h, final Graphics g) {
631
632 repaintClock = false;
633
634 final Calendar calendar = Calendar.getInstance();
635 final int hour = calendar.get(Calendar.HOUR_OF_DAY);
636 final int minute = calendar.get(Calendar.MINUTE);
637 final char[] clock = clockChars;
638
639 clock[0] = (char) ('0' + (hour / 10));
640 clock[1] = (char) ('0' + (hour % 10));
641 clock[3] = (char) ('0' + (minute / 10));
642 clock[4] = (char) ('0' + (minute % 10));
643
644 final int clockPixelWidth = fontStatus.charsWidth(
645 clock, 0, clock.length);
646
647 /*
648 * Clear background
649 */
650 g.setColor(currentScheme.colors[
651 ColorScheme.COLOR_BACKGROUND]);
652
653 g.fillRect(w - clockWidth, h - statusBarHeight, clockWidth,
654 statusBarHeight);
655
656 /*
657 * Draw time
658 */
659
660 fontStatus.drawChars(g, currentScheme.colors[
661 ColorScheme.COLOR_TEXT_STATUS], clock,
662 w - clockPixelWidth - STATUS_BAR_SPACING,
663 h - statusBarHeight + STATUS_BAR_SPACING);
664 }
665
666 private ImageButton findButtonPressed(final int x, final int y) {
667 if (buttons != null) {

Callers 1

paintMethod · 0.95

Calls 5

getMethod · 0.80
charsWidthMethod · 0.80
setColorMethod · 0.80
getInstanceMethod · 0.45
drawCharsMethod · 0.45

Tested by

no test coverage detected