Package com.mxgraph.swing.handler
Class mxRubberband
- java.lang.Object
-
- com.mxgraph.swing.handler.mxRubberband
-
- All Implemented Interfaces:
java.awt.event.MouseListener,java.awt.event.MouseMotionListener,java.util.EventListener
public class mxRubberband extends java.lang.Object implements java.awt.event.MouseListener, java.awt.event.MouseMotionListenerImplements a rubberband selection.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.awt.ColorborderColorDefines the border color for drawing the rubberband selection.protected java.awt.RectangleboundsHolds the current rubberband bounds.protected booleanenabledSpecifies if the rubberband is enabled.protected java.awt.ColorfillColorDefines the color to be used for filling the rubberband selection.protected java.awt.PointfirstHolds the point where the selection has started.protected mxGraphComponentgraphComponentReference to the enclosing graph container.
-
Constructor Summary
Constructors Constructor Description mxRubberband(mxGraphComponent graphComponent)Constructs a new rubberband selection for the given graph component.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.ColorgetBorderColor()Returns the border color.java.awt.ColorgetFillColor()Returns the fill color.booleanisEnabled()Returns the enabled state.booleanisRubberbandTrigger(java.awt.event.MouseEvent e)Returns true if the given event should start the rubberband selection.voidmouseClicked(java.awt.event.MouseEvent arg0)voidmouseDragged(java.awt.event.MouseEvent e)voidmouseEntered(java.awt.event.MouseEvent arg0)voidmouseExited(java.awt.event.MouseEvent arg0)voidmouseMoved(java.awt.event.MouseEvent arg0)voidmousePressed(java.awt.event.MouseEvent e)voidmouseReleased(java.awt.event.MouseEvent e)voidpaintRubberband(java.awt.Graphics g)voidreset()Resets the rubberband selection without carrying out the selection.java.lang.Object[]select(java.awt.Rectangle rect, java.awt.event.MouseEvent e)voidsetBorderColor(java.awt.Color value)Sets the border color.voidsetEnabled(boolean enabled)Sets the enabled state.voidsetFillColor(java.awt.Color value)Sets the fill color.voidstart(java.awt.Point point)Starts the rubberband selection at the given point.
-
-
-
Field Detail
-
borderColor
protected java.awt.Color borderColor
Defines the border color for drawing the rubberband selection. Default is mxConstants.RUBBERBAND_BORDERCOLOR.
-
fillColor
protected java.awt.Color fillColor
Defines the color to be used for filling the rubberband selection. Default is mxConstants.RUBBERBAND_FILLCOLOR.
-
graphComponent
protected mxGraphComponent graphComponent
Reference to the enclosing graph container.
-
enabled
protected boolean enabled
Specifies if the rubberband is enabled.
-
first
protected transient java.awt.Point first
Holds the point where the selection has started.
-
bounds
protected transient java.awt.Rectangle bounds
Holds the current rubberband bounds.
-
-
Constructor Detail
-
mxRubberband
public mxRubberband(mxGraphComponent graphComponent)
Constructs a new rubberband selection for the given graph component.- Parameters:
graphComponent- Component that contains the rubberband.
-
-
Method Detail
-
isEnabled
public boolean isEnabled()
Returns the enabled state.
-
setEnabled
public void setEnabled(boolean enabled)
Sets the enabled state.
-
getBorderColor
public java.awt.Color getBorderColor()
Returns the border color.
-
setBorderColor
public void setBorderColor(java.awt.Color value)
Sets the border color.
-
getFillColor
public java.awt.Color getFillColor()
Returns the fill color.
-
setFillColor
public void setFillColor(java.awt.Color value)
Sets the fill color.
-
isRubberbandTrigger
public boolean isRubberbandTrigger(java.awt.event.MouseEvent e)
Returns true if the given event should start the rubberband selection.
-
start
public void start(java.awt.Point point)
Starts the rubberband selection at the given point.
-
reset
public void reset()
Resets the rubberband selection without carrying out the selection.
-
select
public java.lang.Object[] select(java.awt.Rectangle rect, java.awt.event.MouseEvent e)- Parameters:
rect-e-
-
paintRubberband
public void paintRubberband(java.awt.Graphics g)
-
mousePressed
public void mousePressed(java.awt.event.MouseEvent e)
- Specified by:
mousePressedin interfacejava.awt.event.MouseListener
-
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent e)
- Specified by:
mouseDraggedin interfacejava.awt.event.MouseMotionListener
-
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent e)
- Specified by:
mouseReleasedin interfacejava.awt.event.MouseListener
-
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent arg0)
- Specified by:
mouseClickedin interfacejava.awt.event.MouseListener
-
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent arg0)
- Specified by:
mouseEnteredin interfacejava.awt.event.MouseListener
-
mouseExited
public void mouseExited(java.awt.event.MouseEvent arg0)
- Specified by:
mouseExitedin interfacejava.awt.event.MouseListener
-
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent arg0)
- Specified by:
mouseMovedin interfacejava.awt.event.MouseMotionListener
-
-