|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JLabel
org.tbee.swing.gauge.GaugeNeedleSingle
public abstract class GaugeNeedleSingle
Contains the generic code for a needle gauge. The value per default is percentage [0,100]. You can set the labels separately from the value, for example the labels could depict temperature, but the value still is percentage.
| Nested Class Summary | |
|---|---|
protected static class |
GaugeNeedleSingle.LabelPoint
|
protected static class |
GaugeNeedleSingle.Point2d
|
| Nested classes/interfaces inherited from class javax.swing.JLabel |
|---|
JLabel.AccessibleJLabel |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
protected static FontRenderContext |
cLabelFontRenderContext
|
static String |
SOURCECODE_VERSION
Standard variable for determining version of a class file. |
| Fields inherited from class javax.swing.JLabel |
|---|
labelFor |
| Fields inherited from class javax.swing.JComponent |
|---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface javax.swing.SwingConstants |
|---|
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
GaugeNeedleSingle()
|
|
| Method Summary | |
|---|---|
protected double |
calculateAngle(double value)
|
protected void |
clearImage(BufferedImage image)
|
protected abstract BufferedImage |
drawCompleteGauge()
This generates the complete gauge |
protected void |
drawImageTicks(BufferedImage image,
BufferedImage tick,
GaugeNeedleSingle.Point2d center,
int tickDistance,
double minAngle,
double maxAngle,
int numberOfTicks,
int highlightTicks)
|
protected void |
drawLabels(BufferedImage image,
Font font,
Color color)
|
protected void |
drawNeedle(BufferedImage image,
BufferedImage needle,
GaugeNeedleSingle.Point2d center,
Point offset,
double angle)
|
protected void |
drawNeedleArc(BufferedImage image,
BufferedImage needle,
GaugeNeedleSingle.Point2d center,
Point offset,
double minAngle,
double angle)
|
protected abstract BufferedImage |
drawNeedleOnly()
This only regenerates the needle part. |
protected void |
drawTicks(BufferedImage image,
GaugeNeedleSingle.Point2d center,
int tickDistance,
int tickLength,
double minAngle,
double maxAngle,
int numberOfTicks,
int highlightTicks)
|
protected void |
drawTickTrack(BufferedImage image,
BufferedImage tick,
GaugeNeedleSingle.Point2d center,
int tickDistance,
double minAngle,
double maxAngle,
Color color)
|
protected void |
drawTitle(BufferedImage image,
Font font,
Color color)
|
protected void |
drawUnit(BufferedImage image,
Font font,
Color color)
|
protected double |
getAngle()
|
boolean |
getAnimate()
|
int |
getHighlightTicks()
|
String |
getLabel(int index)
|
protected abstract GaugeNeedleSingle.LabelPoint[] |
getLabelPoints()
LabelPoint[0] is the minvalue and LabelPoint[size-1] is the maxvalue label. |
protected abstract double |
getMaxAngle()
|
double |
getMaxBoundary()
|
double |
getMaxValue()
|
protected abstract double |
getMinAngle()
|
double |
getMinBoundary()
|
protected int |
getMinimalStepDelay()
|
double |
getMinValue()
|
int |
getNumberOfTicks()
|
protected abstract double |
getPowerOffAngle()
|
abstract Dimension |
getPreferredSize()
|
protected double |
getStepSize()
|
String |
getTitle()
|
protected abstract GaugeNeedleSingle.LabelPoint |
getTitleLabelPoint()
|
String |
getUnit()
|
protected abstract GaugeNeedleSingle.LabelPoint |
getUnitLabelPoint()
|
double |
getValue()
|
boolean |
isAnimating()
return if the button currently is animating |
protected boolean |
isMaxAlertVisible()
|
protected boolean |
isMinAlertVisible()
|
boolean |
isPowerOn()
|
protected boolean |
mustDrawMaxAlert()
|
protected boolean |
mustDrawMinAlert()
|
void |
paint(Graphics g)
|
protected void |
setAngle()
|
protected void |
setAngle(double v)
The angle of the needle |
void |
setAnimate(boolean v)
animate |
void |
setHighlightTicks(int cnt)
HighlightTicks |
void |
setLabel(int index,
String label)
set one of the tick labels |
protected void |
setMaxAlertVisible(boolean v)
|
void |
setMaxBoundary(double v)
The Boundary associated with the maximum needle position |
void |
setMaxValue(double v)
The value associated with the maximum needle position |
protected void |
setMinAlertVisible(boolean v)
|
void |
setMinBoundary(double v)
The Boundary associated with the minimum needle position |
void |
setMinValue(double v)
The value associated with the minimum needle position |
void |
setNumberOfTicks(int cnt)
NumberOfTicks |
void |
setPowerOn(boolean v)
Is the gauge under power |
void |
setTitle(String label)
A short text on the cover |
void |
setUnit(String label)
the unit of the value (e.g. |
void |
setValue(double v)
The value associated supposed needle position |
void |
setValueNotAnimated(double v)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String SOURCECODE_VERSION
protected static final FontRenderContext cLabelFontRenderContext
| Constructor Detail |
|---|
public GaugeNeedleSingle()
| Method Detail |
|---|
public void setMinValue(double v)
public double getMinValue()
public void setMaxValue(double v)
public double getMaxValue()
public void setMinBoundary(double v)
public double getMinBoundary()
public void setMaxBoundary(double v)
public double getMaxBoundary()
public void setPowerOn(boolean v)
public boolean isPowerOn()
public void setAnimate(boolean v)
public boolean getAnimate()
public void setTitle(String label)
public String getTitle()
public void setUnit(String label)
public String getUnit()
public void setLabel(int index,
String label)
public String getLabel(int index)
public void setNumberOfTicks(int cnt)
public int getNumberOfTicks()
public void setHighlightTicks(int cnt)
public int getHighlightTicks()
public void setValue(double v)
public double getValue()
public void setValueNotAnimated(double v)
protected void setAngle(double v)
protected double getAngle()
protected abstract double getPowerOffAngle()
protected abstract double getMinAngle()
protected abstract double getMaxAngle()
protected abstract GaugeNeedleSingle.LabelPoint getTitleLabelPoint()
protected abstract GaugeNeedleSingle.LabelPoint getUnitLabelPoint()
protected void setMinAlertVisible(boolean v)
protected boolean isMinAlertVisible()
protected void setMaxAlertVisible(boolean v)
protected boolean isMaxAlertVisible()
protected abstract GaugeNeedleSingle.LabelPoint[] getLabelPoints()
protected double getStepSize()
protected int getMinimalStepDelay()
public abstract Dimension getPreferredSize()
getPreferredSize in class JComponentprotected void setAngle()
protected double calculateAngle(double value)
protected abstract BufferedImage drawCompleteGauge()
protected abstract BufferedImage drawNeedleOnly()
public void paint(Graphics g)
paint in class JComponentpublic boolean isAnimating()
protected void drawTicks(BufferedImage image,
GaugeNeedleSingle.Point2d center,
int tickDistance,
int tickLength,
double minAngle,
double maxAngle,
int numberOfTicks,
int highlightTicks)
protected void drawImageTicks(BufferedImage image,
BufferedImage tick,
GaugeNeedleSingle.Point2d center,
int tickDistance,
double minAngle,
double maxAngle,
int numberOfTicks,
int highlightTicks)
protected void drawTickTrack(BufferedImage image,
BufferedImage tick,
GaugeNeedleSingle.Point2d center,
int tickDistance,
double minAngle,
double maxAngle,
Color color)
protected void drawLabels(BufferedImage image,
Font font,
Color color)
protected void drawUnit(BufferedImage image,
Font font,
Color color)
protected void drawTitle(BufferedImage image,
Font font,
Color color)
protected boolean mustDrawMinAlert()
protected boolean mustDrawMaxAlert()
protected void drawNeedle(BufferedImage image,
BufferedImage needle,
GaugeNeedleSingle.Point2d center,
Point offset,
double angle)
protected void drawNeedleArc(BufferedImage image,
BufferedImage needle,
GaugeNeedleSingle.Point2d center,
Point offset,
double minAngle,
double angle)
protected void clearImage(BufferedImage image)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||