Xoetrope

 Wiki : XGrabMap

HomePage :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register
Carousel logo

XGrabMap

class com.xoetrope.svg.XGrabMap

The XGrabMap class provide a means of dragging an SVG image in conjunction with the XSvgImageMap class using the mouse.

Grabmap

1. Example


public static void main(String[] args)
{
    JFrame frame = new JFrame();
    frame.setSize( 800, 600 );

    XSvgImageMap imageMap = new XSvgImageMap();
    imageMap.setURL( getClass().getResource( "Floor5.svg" ) );
    imageMap.display();

    XGrabMap gb = new XGrabMap( imageMap );

    frame.add( imageMap );
    frame.setVisible( true );
}


In the above example the grab map is passed an XSvgImageMap instance which displays the svg image which will be dragged.

2. Constructor


<?java
public XGrabMap( final XSvgImageMap imageMap )
?>


Creates a new instance of XGrabMap and is passed the XSvgImageMap which is to be grabbed and dragged by the user.

3. Methods


1. setGlassPane
<?java
public void setGlassPane( Component glassPane )
?>


If a glasspane or non-opaque overlay is in use, pass it to this class so it can be set invisible while a dragging operation is occuring.

2. mouseEntered
<?java
public void mouseEntered( MouseEvent e )
?>


Throws a mouse entered event if the mouse enters the bounds of the XSvgImageMap component. The mouse cursor is updated to an open hand image when this event is thrown.

3. mouseExited
<?java
public void mouseExited( MouseEvent e )
?>


Throws a mouse exited event if the mouse exits the bounds of the XSvgImageMap component. The mouse cursor is updated to its default image when this event is thrown.

4. mouseDragged
<?java
public void mouseDragged( MouseEvent e )
?>


Thrown if the mouse is dragged within the bounds of the SVG component. The position of the SVG image is modified accordingly if this event is thrown.

5. mousePressed
<?java
public void mousePressed( MouseEvent e )
?>


Thrown if the mouse is dragged within the bounds of the SVG component. The mouse cursor is updated to a closed hand image when this event is thrown.

6. mouseReleased
<?java
public void mouseReleased( MouseEvent e )
?>


Thrown if the mouse is released within the bounds of the SVG component. The mouse cursor is updated to an open hand image when this event is thrown and the SVG image is repainted at its new position.

There are no comments on this page. [Add comment]

Page was generated in 0.6522 seconds