Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Clock resizing problem, added msec support for Stopwatch, added LCD display to Altimeter #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<groupId>eu.hansolo</groupId>
<artifactId>SteelSeries</artifactId>
<version>3.9.31-SNAPSHOT</version>
<version>3.9.31a</version>
<packaging>jar</packaging>

<name>SteelSeries</name>
Expand Down
31 changes: 9 additions & 22 deletions src/main/java/eu/hansolo/steelseries/extras/Altimeter.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, Gerrit Grunwald
* Copyright (c) 2012, Gerrit Grunwald, Klaus Rheinwald
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -56,7 +56,8 @@

/**
*
* @author hansolo
* @author Gerrit Grunwald <han.solo at muenster.de>
* @author Klaus Rheinwald <klaus at rheinwald.info>
*/
public final class Altimeter extends AbstractRadial {
// <editor-fold defaultstate="collapsed" desc="Variable declaration">
Expand Down Expand Up @@ -251,27 +252,13 @@ protected void paintComponent(Graphics g) {
unitStringWidth = 0;
}
G2.setFont(getLcdValueFont());
switch (getModel().getNumberSystem()) {
case HEX:
valueLayout = new TextLayout(Integer.toHexString((int) getLcdValue()).toUpperCase(), G2.getFont(), RENDER_CONTEXT);
VALUE_BOUNDARY.setFrame(valueLayout.getBounds());
G2.drawString(Integer.toHexString((int) getLcdValue()).toUpperCase(), (float) (LCD.getX() + (LCD.getWidth() - unitStringWidth - VALUE_BOUNDARY.getWidth()) - LCD.getWidth() * 0.09), (float) (LCD.getY() + LCD.getHeight() * 0.76));
break;

case OCT:
valueLayout = new TextLayout(Integer.toOctalString((int) getLcdValue()), G2.getFont(), RENDER_CONTEXT);
VALUE_BOUNDARY.setFrame(valueLayout.getBounds());
G2.drawString(Integer.toOctalString((int) getLcdValue()), (float) (LCD.getX() + (LCD.getWidth() - unitStringWidth - VALUE_BOUNDARY.getWidth()) - LCD.getWidth() * 0.09), (float) (LCD.getY() + LCD.getHeight() * 0.76));
break;

case DEC:

default:
valueLayout = new TextLayout(formatLcdValue(getLcdValue()), G2.getFont(), RENDER_CONTEXT);
VALUE_BOUNDARY.setFrame(valueLayout.getBounds());
G2.drawString(formatLcdValue(getLcdValue()), (float) (LCD.getX() + (LCD.getWidth() - unitStringWidth - VALUE_BOUNDARY.getWidth()) - LCD.getWidth() * 0.09), (float) (LCD.getY() + LCD.getHeight() * 0.76));
break;
int digitalFontNo_1Offset = 0;
if (isDigitalFont() && formatLcdValue(getLcdValue()).startsWith("1")) {
digitalFontNo_1Offset = (int) (LCD.getHeight() * 0.24);
}
valueLayout = new TextLayout(formatLcdValue(getLcdValue()), G2.getFont(), RENDER_CONTEXT);
VALUE_BOUNDARY.setFrame(valueLayout.getBounds());
G2.drawString(formatLcdValue(getLcdValue()), (float) (LCD.getX() + (LCD.getWidth() - unitStringWidth - VALUE_BOUNDARY.getWidth()) - LCD.getWidth() * 0.09) - digitalFontNo_1Offset, (float) (LCD.getY() + LCD.getHeight() * 0.76));
// Draw lcd info string
if (!getLcdInfoString().isEmpty()) {
G2.setFont(getLcdInfoFont());
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/eu/hansolo/steelseries/extras/Clock.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, Gerrit Grunwald
* Copyright (c) 2012, Gerrit Grunwald, Klaus Rheinwald
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -56,7 +56,8 @@

/**
*
* @author hansolo
* @author Gerrit Grunwald <han.solo at muenster.de>
* @author Klaus Rheinwald <klaus at rheinwald.info>
*/
public final class Clock extends AbstractRadial implements java.awt.event.ActionListener {
// <editor-fold defaultstate="collapsed" desc="Variable declaration">
Expand Down Expand Up @@ -1076,6 +1077,8 @@ public void setPreferredSize(final Dimension DIM) {
calcInnerBounds();
init(getGaugeBounds().width, getGaugeBounds().height);
setInitialized(true);
invalidate();
repaint();
}

@Override
Expand Down
Loading