FreeHEP API
Version current

org.freehep.swing.graphics
Class ScaleBorder

java.lang.Object
  extended byorg.freehep.swing.graphics.ScaleBorder
All Implemented Interfaces:
Border

public class ScaleBorder
extends Object
implements Border

This class implements a Border in which the left and bottom sides contain numerical scales.

Version:
$Id: ScaleBorder.java,v 1.5 2002/08/12 17:17:18 duns Exp $
Author:
Charles Loomis
Source Code:
ScaleBorder.java

Field Summary
static int TYPE_GENERAL_TRANSFORM
          Constant describing a transform which does not fall into one of the other categories.
static int TYPE_PARALLEL_TRANSFORM
          Constant describing a transform in which the transformed x and y axes are parallel (or antiparallel) to the original axes.
static int TYPE_SWITCHED_TRANSFORM
          Constant describing a transform in which the transformed x and y axes are parallel (or antiparallel) to the original y and x axes, respectively.
static int TYPE_SWITCHED_X_SKEW_TRANSFORM
          Constant describing a transform in which the transformed x-axis is parallel (or antiparallel) to the original y-axis and the transformed y-axis forms a non-zero angle with the original x-axis.
static int TYPE_SWITCHED_Y_SKEW_TRANSFORM
          Constant describing a transform in which the transformed y-axis is parallel (or antiparallel) to the original x-axis and the transformed x-axis forms a non-zero angle with the original y-axis.
static int TYPE_X_SKEW_TRANSFORM
          Constant describing a transform in which the transformed x-axis is parallel (or antiparallel) to the original x-axis and the transformed y-axis forms a non-zero angle with the original one.
static int TYPE_Y_SKEW_TRANSFORM
          Constant describing a transform in which the transformed y-axis is parallel (or antiparallel) to the original y-axis and the transformed x-axis forms a non-zero angle with the original one.
 
Constructor Summary
ScaleBorder()
          Constructs a ScaleBorder with the default foreground (black) and background (orange) colors.
ScaleBorder(Color bkgColor, Color fgColor)
          Constructs a ScaleBorder with the given background and foreground colors.
 
Method Summary
protected static int classifyTransform(AffineTransform xform)
          This is a protected utility method which classifies the given transform into seven categories: parallel, switched, x-skew, y-skew, switched x-skew, switched y-skew, and general.
 Color getBackgroundColor()
          Get the current background color.
 Insets getBorderInsets(Component c)
          Returns the insets of this border.
 Color getForegroundColor()
          Get the current foreground color.
 Font getLabelFont()
          Get the current font for the labels.
 boolean isBorderOpaque()
          Returns whether or not the border is opaque.
 void paintBorder(Component c, Graphics g, int x, int y, int width, int height)
          Paints the border for the specified component with the specified graphics context, position, and size.
 void setAxisLabels(String horizontalLabel, String verticalLabel)
          Set the axis labels.
 void setAxisUnits(String horizontalUnits, String verticalUnits)
          Set the axis units.
 void setBackgroundColor(Color bkgColor)
          Set the background color.
 void setForegroundColor(Color bkgColor)
          Set the foreground color.
 void setLabelFont(Font labelFont)
          Set the font for the labels.
 void setLimits(double minHoriz, double maxHoriz, double minVert, double maxVert)
          Set the horizontal and vertical limits for the scales.
 void setScales(String horizLabel, String vertLabel, String horizUnits, String vertUnits, AffineTransform transform, int panelWidth, int panelHeight)
          Set the scale labels taking into account the given linear transformation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_PARALLEL_TRANSFORM

public static final int TYPE_PARALLEL_TRANSFORM
Constant describing a transform in which the transformed x and y axes are parallel (or antiparallel) to the original axes.

See Also:
Constant Field Values

TYPE_SWITCHED_TRANSFORM

public static final int TYPE_SWITCHED_TRANSFORM
Constant describing a transform in which the transformed x and y axes are parallel (or antiparallel) to the original y and x axes, respectively.

See Also:
Constant Field Values

TYPE_X_SKEW_TRANSFORM

public static final int TYPE_X_SKEW_TRANSFORM
Constant describing a transform in which the transformed x-axis is parallel (or antiparallel) to the original x-axis and the transformed y-axis forms a non-zero angle with the original one.

See Also:
Constant Field Values

TYPE_Y_SKEW_TRANSFORM

public static final int TYPE_Y_SKEW_TRANSFORM
Constant describing a transform in which the transformed y-axis is parallel (or antiparallel) to the original y-axis and the transformed x-axis forms a non-zero angle with the original one.

See Also:
Constant Field Values

TYPE_SWITCHED_X_SKEW_TRANSFORM

public static final int TYPE_SWITCHED_X_SKEW_TRANSFORM
Constant describing a transform in which the transformed x-axis is parallel (or antiparallel) to the original y-axis and the transformed y-axis forms a non-zero angle with the original x-axis.

See Also:
Constant Field Values

TYPE_SWITCHED_Y_SKEW_TRANSFORM

public static final int TYPE_SWITCHED_Y_SKEW_TRANSFORM
Constant describing a transform in which the transformed y-axis is parallel (or antiparallel) to the original x-axis and the transformed x-axis forms a non-zero angle with the original y-axis.

See Also:
Constant Field Values

TYPE_GENERAL_TRANSFORM

public static final int TYPE_GENERAL_TRANSFORM
Constant describing a transform which does not fall into one of the other categories.

See Also:
Constant Field Values
Constructor Detail

ScaleBorder

public ScaleBorder()
Constructs a ScaleBorder with the default foreground (black) and background (orange) colors.


ScaleBorder

public ScaleBorder(Color bkgColor,
                   Color fgColor)
Constructs a ScaleBorder with the given background and foreground colors.

Method Detail

setBackgroundColor

public void setBackgroundColor(Color bkgColor)
Set the background color.


getBackgroundColor

public Color getBackgroundColor()
Get the current background color.


setForegroundColor

public void setForegroundColor(Color bkgColor)
Set the foreground color.


getForegroundColor

public Color getForegroundColor()
Get the current foreground color.


setLabelFont

public void setLabelFont(Font labelFont)
Set the font for the labels.


getLabelFont

public Font getLabelFont()
Get the current font for the labels.


setLimits

public void setLimits(double minHoriz,
                      double maxHoriz,
                      double minVert,
                      double maxVert)
Set the horizontal and vertical limits for the scales.


setAxisLabels

public void setAxisLabels(String horizontalLabel,
                          String verticalLabel)
Set the axis labels.


setAxisUnits

public void setAxisUnits(String horizontalUnits,
                         String verticalUnits)
Set the axis units.


getBorderInsets

public Insets getBorderInsets(Component c)
Returns the insets of this border.

Specified by:
getBorderInsets in interface Border

isBorderOpaque

public boolean isBorderOpaque()
Returns whether or not the border is opaque. This always returns true.

Specified by:
isBorderOpaque in interface Border

paintBorder

public void paintBorder(Component c,
                        Graphics g,
                        int x,
                        int y,
                        int width,
                        int height)
Paints the border for the specified component with the specified graphics context, position, and size.

Specified by:
paintBorder in interface Border

setScales

public void setScales(String horizLabel,
                      String vertLabel,
                      String horizUnits,
                      String vertUnits,
                      AffineTransform transform,
                      int panelWidth,
                      int panelHeight)
Set the scale labels taking into account the given linear transformation.


classifyTransform

protected static int classifyTransform(AffineTransform xform)
This is a protected utility method which classifies the given transform into seven categories: parallel, switched, x-skew, y-skew, switched x-skew, switched y-skew, and general. The parallel category describes transformations in which the transformed x and y axes are parallel or antiparallel to the original x and y axes, respectively. The switched category describes transformations in which the transformed x and y axes are parallel or antiparallel to the original y and x axes, respectively. That is, the x and y axes have been switched. The x-skew describes transformations in which the transformed x-axis is parallel (or antiparallel) to the original one while the transformed y-axis forms some non-zero angle to the original one. The y-skew is similar; the switch skews are just rotated (counter)clockwise by 90 degrees. The general category encompasses all transforms not falling into one of the other categories.


FreeHEP API
Version current

Copyright © 2000-2004 FreeHEP, All Rights Reserved.