Class JDAxis


public class JDAxis extends JDRectangular
JDraw Axis graphic object. JDAxis allows to build easily sizeable gauges, it supports Font, Label format, auto labelling, and tick.
  • Field Details

    • HORIZONTAL_AXIS

      public static final int HORIZONTAL_AXIS
      Horizontal axis
      See Also:
    • VERTICAL_AXIS

      public static final int VERTICAL_AXIS
      Vertical axis
      See Also:
    • LEFT_LABEL

      public static final int LEFT_LABEL
      Labels are at the left of the axis (Vertical axis only)
      See Also:
    • RIGHT_LABEL

      public static final int RIGHT_LABEL
      Labels are at the right of the axis (Vertical axis only)
      See Also:
    • LINEAR_SCALE

      public static final int LINEAR_SCALE
      Linear scale
      See Also:
    • LOG_SCALE

      public static final int LOG_SCALE
      Logarithmic scale
      See Also:
    • AUTO_FORMAT

      public static final int AUTO_FORMAT
      Use default compiler format to display double
      See Also:
    • SCIENTIFIC_FORMAT

      public static final int SCIENTIFIC_FORMAT
      Display value using exponential representation (x.xxEyy)
      See Also:
    • TIME_FORMAT

      public static final int TIME_FORMAT
      Display number of second as HH:MM:SS
      See Also:
    • DECINT_FORMAT

      public static final int DECINT_FORMAT
      Display integer using decimal format (%d)
      See Also:
    • HEXINT_FORMAT

      public static final int HEXINT_FORMAT
      Display integer using haxadecimal format (%x)
      See Also:
    • BININT_FORMAT

      public static final int BININT_FORMAT
      Display integer using binary format (%b)
      See Also:
    • SCIENTIFICINT_FORMAT

      public static final int SCIENTIFICINT_FORMAT
      Display value using exponential representation (xEyy)
      See Also:
    • theAxis

      protected JLAxis theAxis
  • Constructor Details

    • JDAxis

      public JDAxis(String objectName, int x, int y, int w, int h)
      Construct a JDAxis object.
      Parameters:
      objectName - Object name
      x - Up left corner x coordinate
      y - Up left corner y coordinate
      w - Widht (pixel)
      h - Height (pixel)
  • Method Details

    • copy

      public JDObject copy(int x, int y)
      Description copied from class: JDObject
      Returns a copy of this object at the specified location.
      Specified by:
      copy in class JDObject
      Parameters:
      x - Horizontal position of the copied object (pixel)
      y - Vertical Position of the copied object (pixel)
      Returns:
      The copy of this object.
    • paint

      public void paint(JDrawEditor parent, Graphics g)
      Description copied from class: JDObject
      Paints this object.
      Overrides:
      paint in class JDRectangular
      Parameters:
      parent - JdrawEditor parent (Can be null except for JDSwingObject)
      g - the specified Graphics window
    • hasShadow

      public boolean hasShadow()
      Overrides:
      hasShadow in class JDObject
      Returns:
      true only if this object is shadowed.
    • setForeground

      public void setForeground(Color f)
      Description copied from class: JDObject
      Sets the foreground color (usualy line color) of this object. This color is also used for base shadow color.
      Overrides:
      setForeground in class JDObject
      Parameters:
      f - Foreground color
    • setFont

      public void setFont(Font f)
      Sets the label font of this axis.
      Parameters:
      f - Axis label font
    • getFont

      public Font getFont()
      Returns:
      the label font.
      See Also:
    • setTickCentered

      public void setTickCentered(boolean center)
      Centers or not axis tick.
      Parameters:
      center - True to center tick.
      See Also:
    • isTickCentered

      public boolean isTickCentered()
      Determines whether axis ticks are centered.
      Returns:
      true if tick are centered.
      See Also:
    • setTickWidth

      public void setTickWidth(int width)
      Sets the axis tick width. Passing a negative value will result in displaying tick on the other side of the axis. If tick are centered , negative and positive value will have the same effects.
      Parameters:
      width - Tick width
      See Also:
    • getTickWidth

      public int getTickWidth()
      Returns:
      the current axis tick width.
      See Also:
    • setTickSpacing

      public void setTickSpacing(int spacing)
      Sets the minimum tick spacing (in pixel). Allows to control the number of generated labels.
      Parameters:
      spacing - Minimum tick spacing
    • getTickSpacing

      public int getTickSpacing()
      Returns:
      the current axis spacing (in pixel).
      See Also:
    • setMax

      public void setMax(double m)
      Sets the max value of this axis.
      Parameters:
      m - Max value
    • setMin

      public void setMin(double m)
      Sets the min value of this axis.
      Parameters:
      m - Min value
    • getMax

      public double getMax()
      Returns:
      the max value of this axis.
      See Also:
    • getMin

      public double getMin()
      Returns:
      the min value of this axis.
      See Also:
    • setLabelPos

      public void setLabelPos(int pos)
      Sets the label positionning policy. Works only for vertical axis.
      Parameters:
      pos - Position
      See Also:
    • getLabelPos

      public int getLabelPos()
      Returns:
      the current label positionning policy.
      See Also:
    • setOrientation

      public void setOrientation(int o)
      Sets the axis orientation.
      Parameters:
      o - Orientation value
      See Also:
    • getOrientation

      public int getOrientation()
      Returns:
      the orientation of this axis.
      See Also:
    • setScale

      public void setScale(int s)
      Sets the scale of this axis.
      Parameters:
      s - Scale value
      See Also:
    • getScale

      public int getScale()
      Returns:
      the scale of this axis.
      See Also:
    • setFormat

      public void setFormat(int f)
      Sets the label format of this axis.
      Parameters:
      f - Format value
      See Also:
    • getFormat

      public int getFormat()
      Returns:
      the label format of this axis.
      See Also:
    • setInverted

      public void setInverted(boolean i)
      Invert or not this axis. When enabled , label are going in the opposite side of the screen orientation.
      Parameters:
      i - True to invert this axis.
    • isInverted

      public boolean isInverted()
      Returns:
      whether this axis is inverted.
      See Also: