All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.googlecode.blaisemath.graphics.swing.package.html Maven / Gradle / Ivy



  
    com.googlecode.blaisemath.graphics.swing package
    
  
  
      

Provides swing components for rendering {@link com.googlecode.blaisemath.graphics.Graphic} objects.

Overview

The Graphics Component and the Graphics Tree

{@link com.googlecode.blaisemath.graphics.swing.JGraphicComponent} is the top-level swing component, and works primarily with two classes: a {@link com.googlecode.blaisemath.graphics.swing.JGraphicRoot} and a {@link com.googlecode.blaisemath.style.StyleContext}. As might be expected, the first is responsible for storing the shapes and the second for drawing the shapes. However, the shapes stored in the {@code GraphicRoot} may also provide their own style information. Shapes within the {@code GraphicRoot} are stored as {@link com.googlecode.blaisemath.graphics.core.Graphic}s.

Mouse Handling

Mouse events are delegated through the graphics tree, in addition to being handled at the component level. When passed to graphics, the mouse events are enlarged to include the local coordinate. The following mouse handlers are available:

  • {@link com.googlecode.blaisemath.graphics.swing.PanAndZoomHandler} - pans and zooms canvs, using the mouse wheel or drawing a box (installed on a {@link JGraphicComponent} by invoking {@code PanAndZoomHandler.install()})
  • {@link com.googlecode.blaisemath.graphics.swing.JGraphicSelectionHandler} - enables selecting graphics in various ways, including clicks with control keys and dragging a box; also toggles selection highlighting (installed by default with every {@code JGraphicComponent}, but only handles selection events if the {@code selectionEnabled} flag on the component is set to true)
  • {@link com.googlecode.blaisemath.graphics.swing.JGraphicRoot$MouseHandler} (private class) - delegates mouse events to graphics, maintains references to the current mouse location and current graphic under the mouse (installed by default with {@code JGraphicRoot})
  • {@link com.googlecode.blaisemath.graphics.swing.HighlightOnMouseoverHandler} - highlights graphics when the mouse moves over them (installed by default with every {@code Graphic})
  • {@link com.googlecode.blaisemath.graphics.core.GraphicMoveHandler} - enables moving graphics by dragging (installed for instances of {@code PrimitiveGraphicSupport} when the primitive is a {@code Point2D} and {@code setDragEnabled(true)} is invoked)
  • {@code ShapeDragHandler} (private class) - enables moving graphics by dragging (installed for instances of {@code PrimitiveGraphicSupport} when the primitive is a {@code Point2D} and {@code setDragEnabled(true)} is invoked)
  • {@link com.googlecode.blaisemath.graphics.core.BasicPointSetGraphic$IndexedPointMover} - enables moving individual points in a {@code BasicPointSetGraphic} (installed by default on this graphic)




© 2015 - 2025 Weber Informatics LLC | Privacy Policy