?? thermometerplot.java
字號:
* Returns the range axis.
*
* @return The range axis.
*/
public ValueAxis getRangeAxis() {
return this.rangeAxis;
}
/**
* Sets the range axis for the plot.
*
* @param axis the new axis.
*/
public void setRangeAxis(ValueAxis axis) {
if (axis != null) {
axis.setPlot(this);
axis.addChangeListener(this);
}
// plot is likely registered as a listener with the existing axis...
if (this.rangeAxis != null) {
this.rangeAxis.removeChangeListener(this);
}
this.rangeAxis = axis;
}
/**
* Returns the lower bound for the thermometer. The data value can be set
* lower than this, but it will not be shown in the thermometer.
*
* @return The lower bound.
*
*/
public double getLowerBound() {
return this.lowerBound;
}
/**
* Sets the lower bound for the thermometer.
*
* @param lower the lower bound.
*/
public void setLowerBound(double lower) {
this.lowerBound = lower;
setAxisRange();
}
/**
* Returns the upper bound for the thermometer. The data value can be set
* higher than this, but it will not be shown in the thermometer.
*
* @return The upper bound.
*/
public double getUpperBound() {
return this.upperBound;
}
/**
* Sets the upper bound for the thermometer.
*
* @param upper the upper bound.
*/
public void setUpperBound(double upper) {
this.upperBound = upper;
setAxisRange();
}
/**
* Sets the lower and upper bounds for the thermometer.
*
* @param lower the lower bound.
* @param upper the upper bound.
*/
public void setRange(double lower, double upper) {
this.lowerBound = lower;
this.upperBound = upper;
setAxisRange();
}
/**
* Returns the padding for the thermometer. This is the space inside the
* plot area.
*
* @return The padding.
*/
public RectangleInsets getPadding() {
return this.padding;
}
/**
* Sets the padding for the thermometer.
*
* @param padding the padding.
*/
public void setPadding(RectangleInsets padding) {
this.padding = padding;
notifyListeners(new PlotChangeEvent(this));
}
/**
* Returns the stroke used to draw the thermometer outline.
*
* @return The stroke.
*/
public Stroke getThermometerStroke() {
return this.thermometerStroke;
}
/**
* Sets the stroke used to draw the thermometer outline.
*
* @param s the new stroke (null ignored).
*/
public void setThermometerStroke(Stroke s) {
if (s != null) {
this.thermometerStroke = s;
notifyListeners(new PlotChangeEvent(this));
}
}
/**
* Returns the paint used to draw the thermometer outline.
*
* @return The paint.
*/
public Paint getThermometerPaint() {
return this.thermometerPaint;
}
/**
* Sets the paint used to draw the thermometer outline.
*
* @param paint the new paint (null ignored).
*/
public void setThermometerPaint(Paint paint) {
if (paint != null) {
this.thermometerPaint = paint;
notifyListeners(new PlotChangeEvent(this));
}
}
/**
* Returns the unit display type (none/Fahrenheit/Celcius/Kelvin).
*
* @return The units type.
*/
public int getUnits() {
return this.units;
}
/**
* Sets the units to be displayed in the thermometer.
* <p>
* Use one of the following constants:
*
* <ul>
* <li>UNITS_NONE : no units displayed.</li>
* <li>UNITS_FAHRENHEIT : units displayed in Fahrenheit.</li>
* <li>UNITS_CELCIUS : units displayed in Celcius.</li>
* <li>UNITS_KELVIN : units displayed in Kelvin.</li>
* </ul>
*
* @param u the new unit type.
*/
public void setUnits(int u) {
if ((u >= 0) && (u < UNITS.length)) {
if (this.units != u) {
this.units = u;
notifyListeners(new PlotChangeEvent(this));
}
}
}
/**
* Sets the unit type.
*
* @param u the unit type (null ignored).
*/
public void setUnits(String u) {
if (u == null) {
return;
}
u = u.toUpperCase().trim();
for (int i = 0; i < UNITS.length; ++i) {
if (u.equals(UNITS[i].toUpperCase().trim())) {
setUnits(i);
i = UNITS.length;
}
}
}
/**
* Returns the value location.
*
* @return The location.
*/
public int getValueLocation() {
return this.valueLocation;
}
/**
* Sets the location at which the current value is displayed.
* <P>
* The location can be one of the constants:
* <code>NONE</code>,
* <code>RIGHT</code>
* <code>LEFT</code> and
* <code>BULB</code>.
*
* @param location the location.
*/
public void setValueLocation(int location) {
if ((location >= 0) && (location < 4)) {
this.valueLocation = location;
notifyListeners(new PlotChangeEvent(this));
}
else {
throw new IllegalArgumentException("Location not recognised.");
}
}
/**
* Sets the location at which the axis is displayed with reference to the
* bulb.
* <P>
* The location can be one of the constants:
* <code>NONE</code>,
* <code>RIGHT</code> and
* <code>LEFT</code>.
*
* @param location the location.
*/
public void setAxisLocation(int location) {
if ((location >= 0) && (location < 3)) {
this.axisLocation = location;
notifyListeners(new PlotChangeEvent(this));
}
else {
throw new IllegalArgumentException("Location not recognised.");
}
}
/**
* Returns the axis location.
*
* @return The location.
*/
public int getAxisLocation() {
return this.axisLocation;
}
/**
* Gets the font used to display the current value.
*
* @return The font.
*/
public Font getValueFont() {
return this.valueFont;
}
/**
* Sets the font used to display the current value.
*
* @param f the new font.
*/
public void setValueFont(Font f) {
if ((f != null) && (!this.valueFont.equals(f))) {
this.valueFont = f;
notifyListeners(new PlotChangeEvent(this));
}
}
/**
* Gets the paint used to display the current value.
*
* @return The paint.
*/
public Paint getValuePaint() {
return this.valuePaint;
}
/**
* Sets the paint used to display the current value.
*
* @param p the new paint.
*/
public void setValuePaint(Paint p) {
if ((p != null) && (!this.valuePaint.equals(p))) {
this.valuePaint = p;
notifyListeners(new PlotChangeEvent(this));
}
}
/**
* Sets the formatter for the value label.
*
* @param formatter the new formatter.
*/
public void setValueFormat(NumberFormat formatter) {
if (formatter != null) {
this.valueFormat = formatter;
notifyListeners(new PlotChangeEvent(this));
}
}
/**
* Returns the default mercury paint.
*
* @return The paint.
*/
public Paint getMercuryPaint() {
return this.mercuryPaint;
}
/**
* Sets the default mercury paint.
*
* @param paint the new paint.
*/
public void setMercuryPaint(Paint paint) {
this.mercuryPaint = paint;
notifyListeners(new PlotChangeEvent(this));
}
/**
* Returns the flag that controls whether not value lines are displayed.
*
* @return The flag.
*/
public boolean getShowValueLines() {
return this.showValueLines;
}
/**
* Sets the display as to whether to show value lines in the output.
*
* @param b Whether to show value lines in the thermometer
*/
public void setShowValueLines(boolean b) {
this.showValueLines = b;
notifyListeners(new PlotChangeEvent(this));
}
/**
* Sets information for a particular range.
*
* @param range the range to specify information about.
* @param low the low value for the range
* @param hi the high value for the range
*/
public void setSubrangeInfo(int range, double low, double hi) {
setSubrangeInfo(range, low, hi, low, hi);
}
/**
* Sets the subrangeInfo attribute of the ThermometerPlot object
*
* @param range the new rangeInfo value.
* @param rangeLow the new rangeInfo value
* @param rangeHigh the new rangeInfo value
* @param displayLow the new rangeInfo value
* @param displayHigh the new rangeInfo value
*/
public void setSubrangeInfo(int range,
double rangeLow, double rangeHigh,
double displayLow, double displayHigh) {
if ((range >= 0) && (range < 3)) {
setSubrange(range, rangeLow, rangeHigh);
setDisplayRange(range, displayLow, displayHigh);
setAxisRange();
notifyListeners(new PlotChangeEvent(this));
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -