Class JPane
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JLayeredPane
-
- sgtplot.JPane
-
- All Implemented Interfaces:
- java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.print.Printable, java.io.Serializable, javax.accessibility.Accessible, javax.swing.Scrollable, AbstractPane
- Direct Known Subclasses:
- JGraphicLayout, JPlotPane
public class JPane extends javax.swing.JLayeredPane implements AbstractPane, javax.swing.Scrollable, java.awt.print.Printable
TheJPaneclass is extended fromjavax.swing.JLayeredPaneand is the basis for using thegov.noaa.pmel.sgtpackage with swing components.The Java scientific graphics toolkit is designed to allow a graphics client developer a great deal of flexibility and freedom.
sgtplotis a package that greatly aids a developer in creating graphics applets.sgtplotis not a general purpose graphics package, but provides the tools to enable scientific graphics to be easily incorporated intoJApplet.sgtplothas three main components, the "pane", on which all graphics are drawn. TheJPaneis a fairly simple class and all drawing is done in "device" coordinates (pixels). By default, theJPanewill draw on the screen, but it is designed to allow drawing in an offscreen buffer that can be printed (for applications).The next component is the
Layer. SeveralLayers can be associated with a singleJPane. TheLayerclass insulates the developer from the details of device coordinates by using "physical" coordinates. Physical coordinates are a right-hand coordinate systems with an origin of (0.0, 0.0) in the lower-left-hand corner and have the same scale in both the vertical and horizontal directions. Thus, aLayerthat is 5.0 units wide and 3.0 units high can be made larger and smaller on the screen by resizing theJPane, but will not be distorted. TheLayerclass is responsible for displaying labels, keys (color, vector, and line), and rulers. ALayercan contain a singleGraph.Finally, the
Graphcomponent transforms from user coordinates (e.g. cm/sec, time, degC, or meters) to physical coordinates. TheGraphclasses handle the display of axes and data. Children of theGraphclass are capable of creating Cartesian, polar, and map graphics. For Cartesian graphs, several different axes (log, plain and time), transforms (linear, log, and tablelookup), andCartesianGraph(pixel, line, vector, and contour) classes are available. These classes can be combined in almost any combination.While only one dataset may be plotted per
Layer, co-plotting is supported by allowing layers to use the same transform objects. The order that the layers are plotted can be changed, allowing the developer (or user) to control what may be obscured.Member functions, in package
gov.noaa.pmel.sgt, follow the following naming convention. Member functions that have a P, U, or nothing at the end of the function name are of type double in Physical units, type double in User units, and type int in Device units, respectively. Variables that start with p, u, t, or d are coordinates of type physical, user, time, or device, respectively.All graphics are rendered when the
draw()method is invoked.Mouse Events
Mouse events are processed by the
JPaneobject to support object selection and zooming. Object selection is accomplished by left clicking the mouse on the desired object.JPanethen fires aPropertyChangeEventof type "objectSelected" that can be listened for by the users application. The user application then invokes thegetSelectedObject()method. Zooming is accomplished in several steps.1) Begin a zoom operation by pressing the left button. 2) Describe a zoom rectangle by dragging the mouse with the left button down. 3) Finish the zoom operation by releasing the left mouse button.When the mouse button has been release
JPanefires aPropertyChangeEventof type "zoomRectangle" that can be listened for by the users application. The user application can then obtain the zoom rectangle by invoking thegetZoomBounds()method.... // // register the PropertyChangeListener listener with pane // (assuming that application implements
PropertyChangeListener) // mainPane_.addPropertyChangeListener(this); // ... // // Implement the propertyChange() method and listen for events // public void propertyChange(PropertyChangeEvent event) { // // Listen for property change events from JPane // String name = event.getPropertyName(); if(name.equals("zoomRectangle")) { // // compute zoom rectangle in user units // Range2D xr = new Range2D(); Range2D yr = new Range2D(); Rectangle zm = (Rectangle)event.getNewValue(); // // if rectangle size is one pixel or less return // if(zm.width <= 1 || zm.height <= 1) return; xr.start = graph_.getXPtoU(layer_.getXDtoP(zm.x)); xr.end = graph_.getXPtoU(layer_.getXDtoP(zm.x + zm.width)); if(xr.start > xr.end) { double temp = xr.start; xr.start = xr.end; xr.end = temp; } yr.start = graph_.getYPtoU(layer_.getYDtoP(zm.y)); yr.end = graph_.getYPtoU(layer_.getYDtoP(zm.y + zm.height)); if(yr.start > yr.end) { double temp = yr.start; yr.start = yr.end; yr.end = temp; } // // turn batching on so all changes will appear at the // same time // mainPane_.setBatch(true); // // set range for transforms // xt_.setRangeU(xr); yt_.setRangeU(yr); // // set range and origin for axes // Point2D.Double orig = new Point2D.Double(xr.start, yr.start); xbot_.setRangeU(xr); xbot_.setLocationU(orig); yleft_.setRangeU(yr); yleft_.setLocationU(orig); // // set clipping on all graphs // Component[] comps = mainPane_.getComponents(); Layer ly; for(int i=0; i < comps.length; i++) { if(comps[i] instanceof Layer) { ly = (Layer)comps[i]; ((CartesianGraph)ly.getGraph()).setClip(xr.start, xr.end, yr.start, yr.end); } } // // done with sgtplot modifications, turn batching off // mainPane_.setBatch(false); } else if(name.equals("objectSelected")) { // // An sgtplot object has been selected. // If it is a PointCartesianRenderer that means the key has been // selected and so open a dialog to modified the PointAttribute. // if(event.getNewValue() instanceof PointCartesianRenderer) { PointAttribute pattr = ((PointCartesianRenderer)event.getNewValue()).getPointAttribute(); if(pAttrDialog_ == null) { pAttrDialog_ = new PointAttributeDialog(); } pAttrDialog_.setPointAttribute(pattr, mainPane_); pAttrDialog_.setVisible(true); } else { // // Print the name of the object selected. // System.out.println("objectSelected = " + event.getNewValue()); } } }- Since:
- 2.0
- See Also:
Layer,Graph,Graphics, Serialized Form
-
-
Nested Class Summary
-
Field Summary
-
Fields inherited from class javax.swing.JLayeredPane
DEFAULT_LAYER, DRAG_LAYER, FRAME_CONTENT_LAYER, LAYER_PROPERTY, MODAL_LAYER, PALETTE_LAYER, POPUP_LAYER
-
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
Fields inherited from interface sgtplot.AbstractPane
BOTTOM, CENTER, DEFAULT_SCALE, LEFT, MIDDLE, RIGHT, SHRINK_TO_FIT, SPECIFIED_LOCATION, TO_FIT, TOP
-
-
Constructor Summary
Constructors Constructor and Description JPane()Default constructor.JPane(java.lang.String id, java.awt.Dimension size)Constructs aPane.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description java.awt.Componentadd(java.awt.Component comp)Adds the specified component to the end of thePane.java.awt.Componentadd(java.awt.Component comp, int index)Adds the specified component to thePaneat the given position.voidadd(java.awt.Component comp, java.lang.Object constraints)Adds the specified component to the end of thisPane.voidadd(java.awt.Component comp, java.lang.Object constraints, int index)Adds the specified component to the end of thisPaneat the specified index.java.awt.Componentadd(java.lang.String name, java.awt.Component comp)Adds the specified component to thisPane.voidaddPropertyChangeListener(java.beans.PropertyChangeListener l)Add a PropertyChangeListener to the list.voiddraw()TheAbstractPaneand all of the attached Classes will be drawn.voiddraw(java.awt.Graphics g)TheAbstractPaneand all of the attached Classes will be drawn.voiddraw(java.awt.Graphics g, int width, int height)TheAbstractPaneand all of the attached Classes will be drawn.voiddraw(org.freehep.graphics2d.VectorGraphics g)voiddraw(org.freehep.graphics2d.VectorGraphics g, int width, int height)voiddraw(org.freehep.graphics2d.VectorGraphics g, java.lang.String s)voiddrawPage(org.freehep.graphics2d.VectorGraphics g, java.awt.print.PageFormat pf, boolean scale)java.awt.ComponentgetComponent()Get theComponentassociated with the pane.LayergetFirstLayer()Get the firstLayerassociated with thePanejava.lang.StringgetId()Get thePaneidentifier.LayergetLayer(java.lang.String id)Get theLayerassociated with thePaneindicated by the id.LayergetLayerFromDataId(java.lang.String id)Get theLayerassociated with thePaneindicated by the data id.java.awt.DimensiongetMaximumSize()java.awt.DimensiongetMinimumSize()java.lang.ObjectgetObjectAt(int x, int y)Get the current selected object at a point.java.lang.Object[]getObjectsAt(int x, int y)Return an array of objects whose bounds include x,y.java.lang.Object[]getObjectsAt(java.awt.Point pt)Return an array of objects whose bounds are at point pt.intgetPageHAlign()Get horizontal alignment for printing.java.awt.PointgetPageOrigin()Get the printer page origin.intgetPageScaleMode()Get printing scale mode.java.awt.DimensiongetPageSize()Get the printer page size.intgetPageVAlign()Get vertical alignment for printing.java.awt.DimensiongetPreferredScrollableViewportSize()java.awt.DimensiongetPreferredSize()intgetScrollableBlockIncrement(java.awt.Rectangle visibleRect, int orientation, int direction)booleangetScrollableTracksViewportHeight()booleangetScrollableTracksViewportWidth()intgetScrollableUnitIncrement(java.awt.Rectangle visibleRect, int orientation, int direction)java.lang.ObjectgetSelectedObject()Return the last object selected.static StrokeDrawergetStrokeDrawer()Internal method to access jdk1.1 or Java2D line drawing.static java.lang.StringgetVersion()Return the version of SGT.java.awt.RectanglegetZoomBounds()Get the current zoom bounding box.java.awt.PointgetZoomStart()Return the device coordinates of the start of the zoom action.voidinit()No initialization required.booleanisBatch()Is batching turned on?booleanisModified()Has the plot been modified?booleanisMouseEventsEnabled()AreMouseEvents enabled for processing by SGT?booleanisPrinter()Test if the currentGraphicsobject is a printer.voidmoveLayerDown(Layer lyr)Move theLayerdown in the stack.voidmoveLayerDown(java.lang.String id)Move theLayerdown in the stack.voidmoveLayerUp(Layer lyr)Move theLayerup in the stack.voidmoveLayerUp(java.lang.String id)Move theLayerup in the stack.voidpaintComponent(java.awt.Graphics g)Override default painting by swing.intprint(java.awt.Graphics g, java.awt.print.PageFormat pf, int pageIndex)voidprocessMouseEvent(java.awt.event.MouseEvent event)Overrides the default event methods.voidprocessMouseMotionEvent(java.awt.event.MouseEvent event)Used internally by sgtplot.voidremovePropertyChangeListener(java.beans.PropertyChangeListener l)Remove the PropertyChangeListener from the list.voidsetBatch(boolean batch)Turn on/off batching of updates to the pane.voidsetBatch(boolean batch, java.lang.String msg)Turn on/off batching of updates to the pane.voidsetId(java.lang.String id)Set thePaneidentifiervoidsetModified(boolean mod, java.lang.String mess)Notify the pane that something has changed and a redraw is required.voidsetMouseEventsEnabled(boolean enable)Enable/disable the handling ofMouseEvents by SGT.voidsetPageAlign(int vert, int horz)Set alignment for printing.voidsetPageHAlign(int horz)Set horizontal alignment for printing.voidsetPageOrigin(java.awt.Point p)Set the printer page origin.voidsetPageScaleMode(int mode)Set printing scale mode.voidsetPageVAlign(int vert)Set vertical alignment for printing.voidsetScrollableBlockIncrement(int horiz, int vert)Set the horizontal and vertical block increments.voidsetScrollableUnitIncrement(int horiz, int vert)Set the horizontal and vertical unit increments.voidsetSelectedObject(java.lang.Object obj)Primarily used internally by sgtplot.voidsetSize(java.awt.Dimension d)Set the size.java.lang.StringtoString()Get aStringrepresentatinof thePane.-
Methods inherited from class javax.swing.JLayeredPane
getAccessibleContext, getComponentCountInLayer, getComponentsInLayer, getIndexOf, getLayer, getLayer, getLayeredPaneAbove, getPosition, highestLayer, isOptimizedDrawingEnabled, lowestLayer, moveToBack, moveToFront, paint, putLayer, remove, removeAll, setLayer, setLayer, setPosition
-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
-
Methods inherited from class java.awt.Container
addContainerListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, show, show, size, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface sgtplot.AbstractPane
getBounds
-
-
-
-
Constructor Detail
-
JPane
public JPane(java.lang.String id, java.awt.Dimension size)Constructs aPane.- Parameters:
id- thePaneidentifiersize- the size of thePanein pixels
-
JPane
public JPane()
Default constructor. The identifier is set to an empty string and the size is set to a width and height of 50 pixels. A default constructor is required to work as a component with Visual Cafe.import gov.noaa.pmel.sgt.JPane; ... JPane pane; ... pane = new JPane("main graph", new Dimension(400, 500)); pane.setLayout(new StackedLayout()); ...- See Also:
StackedLayout
-
-
Method Detail
-
getVersion
public static java.lang.String getVersion()
Return the version of SGT.- Since:
- 3.0
-
draw
public void draw(org.freehep.graphics2d.VectorGraphics g, java.lang.String s)
-
draw
public void draw()
Description copied from interface:AbstractPaneTheAbstractPaneand all of the attached Classes will be drawn. Drawing will occur in an offscreen image and then copied to the screen. A new offscreen image is created on the first call to draw() or if the size of the pane has been changed. The offscreen image will be used as a "double" buffer when the screen requires redrawing.Each
Layerthat has been added will be drawn in the order added, except if that order has been change using themoveLayerUp()ormoveLayerDown()methods.- Specified by:
drawin interfaceAbstractPane- See Also:
Graphics,Layer
-
init
public void init()
No initialization required.- Specified by:
initin interfaceAbstractPane
-
draw
public void draw(org.freehep.graphics2d.VectorGraphics g)
-
draw
public void draw(org.freehep.graphics2d.VectorGraphics g, int width, int height)
-
isPrinter
public boolean isPrinter()
Description copied from interface:AbstractPaneTest if the currentGraphicsobject is a printer.- Specified by:
isPrinterin interfaceAbstractPane- Returns:
- true if a printer
-
getStrokeDrawer
public static StrokeDrawer getStrokeDrawer()
Internal method to access jdk1.1 or Java2D line drawing.
-
getPageSize
public java.awt.Dimension getPageSize()
Description copied from interface:AbstractPaneGet the printer page size.- Specified by:
getPageSizein interfaceAbstractPane- Returns:
- page size
-
paintComponent
public void paintComponent(java.awt.Graphics g)
Override default painting by swing.- Overrides:
paintComponentin classjavax.swing.JComponent
-
add
public java.awt.Component add(java.awt.Component comp)
Adds the specified component to the end of thePane.- Overrides:
addin classjava.awt.Container- Parameters:
comp- the component to be added- Returns:
- component argument
-
add
public java.awt.Component add(java.awt.Component comp, int index)Adds the specified component to thePaneat the given position.- Overrides:
addin classjava.awt.Container- Parameters:
comp- the component to be addedindex- the position at which to insert the component, or -1 to insert the component at the end.- Returns:
- component argument
-
add
public void add(java.awt.Component comp, java.lang.Object constraints)Adds the specified component to the end of thisPane. Also notifies the layout manager to add the component to thisPane's layout using the specified constraints object.- Overrides:
addin classjava.awt.Container- Parameters:
comp- the component to be addedconstraints- an object expressing layout constraints for this component
-
add
public void add(java.awt.Component comp, java.lang.Object constraints, int index)Adds the specified component to the end of thisPaneat the specified index. Also notifies the layout manager to add the component to thisPane's layout using the specified constraints object.- Overrides:
addin classjava.awt.Container- Parameters:
comp- the component to be addedconstraints- an object expressing layout constraints for this componentindex- the position in thePane's list at which to insert the component -1 means insert at the end.
-
add
public java.awt.Component add(java.lang.String name, java.awt.Component comp)Adds the specified component to thisPane. It is strongly advised to use add(Component, Object), in place of this method.- Overrides:
addin classjava.awt.Container
-
getId
public java.lang.String getId()
Description copied from interface:AbstractPaneGet thePaneidentifier.- Specified by:
getIdin interfaceAbstractPane- Returns:
Stringcontaining thePaneidentifier.
-
setId
public void setId(java.lang.String id)
Description copied from interface:AbstractPaneSet thePaneidentifier- Specified by:
setIdin interfaceAbstractPane
-
setPageAlign
public void setPageAlign(int vert, int horz)Description copied from interface:AbstractPaneSet alignment for printing.- Specified by:
setPageAlignin interfaceAbstractPane- Parameters:
vert- vertical alignmenthorz- horizontal alignment- See Also:
AbstractPane.TOP,AbstractPane.MIDDLE,AbstractPane.BOTTOM,AbstractPane.LEFT,AbstractPane.CENTER,AbstractPane.RIGHT,AbstractPane.SPECIFIED_LOCATION
-
setPageVAlign
public void setPageVAlign(int vert)
Description copied from interface:AbstractPaneSet vertical alignment for printing. Allowed choices includeTOP,MIDDLE, andBOTTOMfor vert andLEFT,CENTER, andRIGHTfor horz. Either can beSPECIFIED_LOCATION.- Specified by:
setPageVAlignin interfaceAbstractPane- Parameters:
vert- vertical alignment- See Also:
AbstractPane.TOP,AbstractPane.MIDDLE,AbstractPane.BOTTOM,AbstractPane.SPECIFIED_LOCATION
-
setPageHAlign
public void setPageHAlign(int horz)
Description copied from interface:AbstractPaneSet horizontal alignment for printing. Allowed choices includeTOP,MIDDLE, andBOTTOM.- Specified by:
setPageHAlignin interfaceAbstractPane- Parameters:
horz- horizontal alignment- See Also:
AbstractPane.LEFT,AbstractPane.CENTER,AbstractPane.RIGHT,AbstractPane.SPECIFIED_LOCATION
-
getPageVAlign
public int getPageVAlign()
Description copied from interface:AbstractPaneGet vertical alignment for printing. Allowed choices includeLEFT,CENTER, andRIGHT.- Specified by:
getPageVAlignin interfaceAbstractPane- Returns:
- vertical alignment
- See Also:
AbstractPane.TOP,AbstractPane.MIDDLE,AbstractPane.BOTTOM,AbstractPane.SPECIFIED_LOCATION
-
getPageHAlign
public int getPageHAlign()
Description copied from interface:AbstractPaneGet horizontal alignment for printing.- Specified by:
getPageHAlignin interfaceAbstractPane- Returns:
- horizontal alignment
- See Also:
AbstractPane.LEFT,AbstractPane.CENTER,AbstractPane.RIGHT,AbstractPane.SPECIFIED_LOCATION
-
setPageOrigin
public void setPageOrigin(java.awt.Point p)
Description copied from interface:AbstractPaneSet the printer page origin. Valid for HAlign =SPECIFIED_LOCATIONor VAlign =SPECIFIED_LOCATION.- Specified by:
setPageOriginin interfaceAbstractPane
-
getPageOrigin
public java.awt.Point getPageOrigin()
Description copied from interface:AbstractPaneGet the printer page origin. Valid for HAlign =SPECIFIED_LOCATIONor VAlign =SPECIFIED_LOCATION.- Specified by:
getPageOriginin interfaceAbstractPane
-
setSize
public void setSize(java.awt.Dimension d)
Set the size.- Overrides:
setSizein classjava.awt.Component
-
getFirstLayer
public Layer getFirstLayer()
Description copied from interface:AbstractPaneGet the firstLayerassociated with thePane- Specified by:
getFirstLayerin interfaceAbstractPane- Returns:
- the first
Layerobject
-
getLayer
public Layer getLayer(java.lang.String id) throws LayerNotFoundException
Description copied from interface:AbstractPaneGet theLayerassociated with thePaneindicated by the id.- Specified by:
getLayerin interfaceAbstractPane- Parameters:
id- identifier.- Throws:
LayerNotFoundException- TheLayerindicated by the id was not found.
-
getLayerFromDataId
public Layer getLayerFromDataId(java.lang.String id) throws LayerNotFoundException
Description copied from interface:AbstractPaneGet theLayerassociated with thePaneindicated by the data id.- Specified by:
getLayerFromDataIdin interfaceAbstractPane- Parameters:
id- data identifier- Throws:
LayerNotFoundException- TheLayerindicated by the id was not found.- See Also:
SGTData
-
moveLayerUp
public void moveLayerUp(Layer lyr) throws LayerNotFoundException
Move theLayerup in the stack. The order of the layers determine when they are drawn. Moving theLayerup causes theLayerto be drawn later and over earlier layers.- Parameters:
lyr-Layerobject.- Throws:
LayerNotFoundException- The specifiedLayerwas not found in the list.- See Also:
Layer
-
moveLayerUp
public void moveLayerUp(java.lang.String id) throws LayerNotFoundExceptionMove theLayerup in the stack. The order of the layers determine when they are drawn. Moving theLayerup causes theLayerto be drawn later and over earlier layers.- Parameters:
id- identifier.- Throws:
LayerNotFoundException- The specifiedLayerwas not found in the list.- See Also:
Layer
-
moveLayerDown
public void moveLayerDown(Layer lyr) throws LayerNotFoundException
Move theLayerdown in the stack. The order of the layers determine when they are drawn. Moving theLayerdown causes theLayerto be drawn earlier.- Parameters:
lyr-Layerobject.- Throws:
LayerNotFoundException- The specifiedLayerwas not found in the list.- See Also:
Layer
-
moveLayerDown
public void moveLayerDown(java.lang.String id) throws LayerNotFoundExceptionMove theLayerdown in the stack. The order of the layers determine when they are drawn. Moving theLayerdown causes theLayerto be drawn earlier.- Parameters:
id- identifier- Throws:
LayerNotFoundException- The specifiedLayerwas not found in the list.- See Also:
Layer
-
getSelectedObject
public java.lang.Object getSelectedObject()
Description copied from interface:AbstractPaneReturn the last object selected. Returns only objects that are part ofLayers currently connected to the pane.AbstractPanetests each layer after a MOUSE_DOWN event for an object whose bounding box contains the mouse. The pane object then passes the event on to the next level.- Specified by:
getSelectedObjectin interfaceAbstractPane
-
setSelectedObject
public void setSelectedObject(java.lang.Object obj)
Description copied from interface:AbstractPanePrimarily used internally by sgtplot. This can also be used to mark an object as selected for use in an event handler.- Specified by:
setSelectedObjectin interfaceAbstractPane
-
processMouseEvent
public void processMouseEvent(java.awt.event.MouseEvent event)
Overrides the default event methods.- Overrides:
processMouseEventin classjavax.swing.JComponent
-
processMouseMotionEvent
public void processMouseMotionEvent(java.awt.event.MouseEvent event)
Used internally by sgtplot.- Overrides:
processMouseMotionEventin classjavax.swing.JComponent
-
getZoomBounds
public java.awt.Rectangle getZoomBounds()
Get the current zoom bounding box.- Specified by:
getZoomBoundsin interfaceAbstractPane- Returns:
- zoom rectangle
-
getZoomStart
public java.awt.Point getZoomStart()
Description copied from interface:AbstractPaneReturn the device coordinates of the start of the zoom action. ThePointis in device coordinates and may require transformation to physical units or user units. Zoom start may be useful to indicate which graph to zoom.- Specified by:
getZoomStartin interfaceAbstractPane- Returns:
- zoom start
- Since:
- 3.0
-
getObjectAt
public java.lang.Object getObjectAt(int x, int y)Description copied from interface:AbstractPaneGet the current selected object at a point. Used internally by sgtplot.- Specified by:
getObjectAtin interfaceAbstractPane
-
getObjectsAt
public java.lang.Object[] getObjectsAt(int x, int y)Description copied from interface:AbstractPaneReturn an array of objects whose bounds include x,y.- Specified by:
getObjectsAtin interfaceAbstractPane- Since:
- 3.0
-
getObjectsAt
public java.lang.Object[] getObjectsAt(java.awt.Point pt)
Description copied from interface:AbstractPaneReturn an array of objects whose bounds are at point pt.- Specified by:
getObjectsAtin interfaceAbstractPane- Since:
- 3.0
-
getComponent
public java.awt.Component getComponent()
Description copied from interface:AbstractPaneGet theComponentassociated with the pane.- Specified by:
getComponentin interfaceAbstractPane
-
getMaximumSize
public java.awt.Dimension getMaximumSize()
- Overrides:
getMaximumSizein classjavax.swing.JComponent
-
getMinimumSize
public java.awt.Dimension getMinimumSize()
- Overrides:
getMinimumSizein classjavax.swing.JComponent
-
getPreferredSize
public java.awt.Dimension getPreferredSize()
- Overrides:
getPreferredSizein classjavax.swing.JComponent
-
toString
public java.lang.String toString()
Get aStringrepresentatinof thePane.- Overrides:
toStringin classjava.awt.Component- Returns:
Stringrepresentation
-
setBatch
public void setBatch(boolean batch, java.lang.String msg)Description copied from interface:AbstractPaneTurn on/off batching of updates to the pane. While batching istrueproperty change events will not cause pane to redraw. When batching is turned back on if the pane has been modified it will then redraw.- Specified by:
setBatchin interfaceAbstractPane
-
setBatch
public void setBatch(boolean batch)
Description copied from interface:AbstractPaneTurn on/off batching of updates to the pane. While batching istrueproperty change events will not cause pane to redraw. When batching is turned back on if the pane has been modified it will then redraw.- Specified by:
setBatchin interfaceAbstractPane
-
isBatch
public boolean isBatch()
Description copied from interface:AbstractPaneIs batching turned on?- Specified by:
isBatchin interfaceAbstractPane
-
setModified
public void setModified(boolean mod, java.lang.String mess)Description copied from interface:AbstractPaneNotify the pane that something has changed and a redraw is required. Used internally by sgtplot.- Specified by:
setModifiedin interfaceAbstractPane
-
isModified
public boolean isModified()
Description copied from interface:AbstractPaneHas the plot been modified?- Specified by:
isModifiedin interfaceAbstractPane
-
setMouseEventsEnabled
public void setMouseEventsEnabled(boolean enable)
Description copied from interface:AbstractPaneEnable/disable the handling ofMouseEvents by SGT. Disabling mouse events will turn off object selection, moveable, selectable, draggable, and zooming.- Specified by:
setMouseEventsEnabledin interfaceAbstractPane- Since:
- 3.0
-
isMouseEventsEnabled
public boolean isMouseEventsEnabled()
Description copied from interface:AbstractPaneAreMouseEvents enabled for processing by SGT?- Specified by:
isMouseEventsEnabledin interfaceAbstractPane- Since:
- 3.0
-
setScrollableBlockIncrement
public void setScrollableBlockIncrement(int horiz, int vert)Set the horizontal and vertical block increments.
-
getScrollableBlockIncrement
public int getScrollableBlockIncrement(java.awt.Rectangle visibleRect, int orientation, int direction)- Specified by:
getScrollableBlockIncrementin interfacejavax.swing.Scrollable
-
setScrollableUnitIncrement
public void setScrollableUnitIncrement(int horiz, int vert)Set the horizontal and vertical unit increments.
-
getScrollableUnitIncrement
public int getScrollableUnitIncrement(java.awt.Rectangle visibleRect, int orientation, int direction)- Specified by:
getScrollableUnitIncrementin interfacejavax.swing.Scrollable
-
getPreferredScrollableViewportSize
public java.awt.Dimension getPreferredScrollableViewportSize()
- Specified by:
getPreferredScrollableViewportSizein interfacejavax.swing.Scrollable
-
getScrollableTracksViewportHeight
public boolean getScrollableTracksViewportHeight()
- Specified by:
getScrollableTracksViewportHeightin interfacejavax.swing.Scrollable
-
getScrollableTracksViewportWidth
public boolean getScrollableTracksViewportWidth()
- Specified by:
getScrollableTracksViewportWidthin interfacejavax.swing.Scrollable
-
print
public int print(java.awt.Graphics g, java.awt.print.PageFormat pf, int pageIndex)- Specified by:
printin interfacejava.awt.print.Printable
-
setPageScaleMode
public void setPageScaleMode(int mode)
Description copied from interface:AbstractPaneSet printing scale mode. Allowable choices areTO_FIT,SHRINK_TO_FITandDEFAULT_SCALE. Default = DEFAULT_SCALE.- Specified by:
setPageScaleModein interfaceAbstractPane- Parameters:
mode- print page scaling- See Also:
AbstractPane.DEFAULT_SCALE,AbstractPane.TO_FIT,AbstractPane.SHRINK_TO_FIT
-
getPageScaleMode
public int getPageScaleMode()
Description copied from interface:AbstractPaneGet printing scale mode.- Specified by:
getPageScaleModein interfaceAbstractPane- Returns:
- AUTO_SCALE, TO_FIT, or SHRINK_TO_FIT
- See Also:
AbstractPane.DEFAULT_SCALE,AbstractPane.TO_FIT,AbstractPane.SHRINK_TO_FIT
-
drawPage
public void drawPage(org.freehep.graphics2d.VectorGraphics g, java.awt.print.PageFormat pf, boolean scale)
-
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
Description copied from interface:AbstractPaneAdd a PropertyChangeListener to the list. Properties forPaneandJPaneinclude "objectSelected" and "zoomRectangle".- Specified by:
addPropertyChangeListenerin interfaceAbstractPane- Overrides:
addPropertyChangeListenerin classjava.awt.Container
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
Description copied from interface:AbstractPaneRemove the PropertyChangeListener from the list.- Specified by:
removePropertyChangeListenerin interfaceAbstractPane- Overrides:
removePropertyChangeListenerin classjava.awt.Component
-
draw
public void draw(java.awt.Graphics g)
Description copied from interface:AbstractPaneTheAbstractPaneand all of the attached Classes will be drawn. Drawing will occur using the suppliedGraphicsobject.- Specified by:
drawin interfaceAbstractPane- Parameters:
g- User suppliedGraphicsobject- See Also:
Graphics
-
draw
public void draw(java.awt.Graphics g, int width, int height)Description copied from interface:AbstractPaneTheAbstractPaneand all of the attached Classes will be drawn. Drawing will occur using the suppliedGraphicsobject. And clipping will be done to the width and height.- Specified by:
drawin interfaceAbstractPane- Parameters:
g- User suppliedGraphicsobjectwidth- clipping widthheight- clipping height- See Also:
Graphics
-
-
DMelt 3.0 © DataMelt by jWork.ORG