org.opensourcephysics.display
Class InteractiveLabel

java.lang.Object
  extended by org.opensourcephysics.display.Circle
      extended by org.opensourcephysics.display.MeasuredCircle
          extended by org.opensourcephysics.display.InteractiveLabel
All Implemented Interfaces:
Drawable, Interactive, Measurable

public class InteractiveLabel
extends MeasuredCircle
implements Interactive


Field Summary
static int CENTER_LOCATION
           
 int connection_location
           
static int TOP_CENTER_LOCATION
           
static int TOP_LEFT_LOCATION
           
 
Fields inherited from class org.opensourcephysics.display.Circle
color, pixRadius
 
Constructor Summary
InteractiveLabel()
          Constructor InteractiveLabel
InteractiveLabel(java.lang.String str)
          Constructor InteractiveLabel
 
Method Summary
 void draw(DrawingPanel panel, java.awt.Graphics g)
          Draws the circle.
 Interactive findInteractive(DrawingPanel panel, int xpix, int ypix)
           
 int getOffsetX()
          Gets the label's offset in the x direction.
 int getOffsetY()
          Gets the label's offset in the y direction.
 boolean isEnabled()
          Gets the mouse interaction enabled property.
 boolean isInside(DrawingPanel panel, int xpix, int ypix)
          Checks to see if this object is enabled and if the pixel coordinates are inside the drawable.
 void resetBoxSize()
           
 void setConnectionPoint(int location)
          Sets the location of the connection point.
 void setEnabled(boolean enabled)
          Enables mouse interactions
 void setOffsetX(int offset)
          Sets the label's offset in the x direction.
 void setOffsetY(int offset)
          Sets the label's offset in the y direction.
 void setText(java.lang.String _text)
           
 void setText(java.lang.String _text, double _x, double _y)
           
 void setXY(double _x, double _y)
          Sets the x and y coordinates.
 
Methods inherited from class org.opensourcephysics.display.MeasuredCircle
getLoader, getXMax, getXMin, getYMax, getYMin, isMeasured, setMeasured
 
Methods inherited from class org.opensourcephysics.display.Circle
getX, getY, setX, setY, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.opensourcephysics.display.Interactive
getX, getY, setX, setY
 
Methods inherited from interface org.opensourcephysics.display.Measurable
getXMax, getXMin, getYMax, getYMin, isMeasured
 

Field Detail

TOP_LEFT_LOCATION

public static final int TOP_LEFT_LOCATION
See Also:
Constant Field Values

CENTER_LOCATION

public static final int CENTER_LOCATION
See Also:
Constant Field Values

TOP_CENTER_LOCATION

public static final int TOP_CENTER_LOCATION
See Also:
Constant Field Values

connection_location

public int connection_location
Constructor Detail

InteractiveLabel

public InteractiveLabel()
Constructor InteractiveLabel


InteractiveLabel

public InteractiveLabel(java.lang.String str)
Constructor InteractiveLabel

Parameters:
str -
Method Detail

setXY

public void setXY(double _x,
                  double _y)
Description copied from class: Circle
Sets the x and y coordinates.

Specified by:
setXY in interface Interactive
Overrides:
setXY in class Circle

setText

public void setText(java.lang.String _text)

setText

public void setText(java.lang.String _text,
                    double _x,
                    double _y)

resetBoxSize

public void resetBoxSize()

setConnectionPoint

public void setConnectionPoint(int location)
Sets the location of the connection point. Location values are:TOP_LEFT_LOCATION, TOP_CENTER_LOCATION

Parameters:
location - int

setOffsetX

public void setOffsetX(int offset)
Sets the label's offset in the x direction.

Parameters:
offset - int

getOffsetX

public int getOffsetX()
Gets the label's offset in the x direction.

Parameters:
offset - int

setOffsetY

public void setOffsetY(int offset)
Sets the label's offset in the y direction.

Parameters:
offset - int

getOffsetY

public int getOffsetY()
Gets the label's offset in the y direction.

Parameters:
offset - int

draw

public void draw(DrawingPanel panel,
                 java.awt.Graphics g)
Description copied from class: Circle
Draws the circle.

Specified by:
draw in interface Drawable
Overrides:
draw in class Circle

findInteractive

public Interactive findInteractive(DrawingPanel panel,
                                   int xpix,
                                   int ypix)
Specified by:
findInteractive in interface Interactive

isInside

public boolean isInside(DrawingPanel panel,
                        int xpix,
                        int ypix)
Checks to see if this object is enabled and if the pixel coordinates are inside the drawable.

Parameters:
panel -
xpix -
ypix -
Returns:
true if the pixel coordinates are inside; false otherwise

setEnabled

public void setEnabled(boolean enabled)
Enables mouse interactions

Specified by:
setEnabled in interface Interactive
Parameters:
enabled - boolean

isEnabled

public boolean isEnabled()
Gets the mouse interaction enabled property.

Specified by:
isEnabled in interface Interactive
Returns:
boolean