Module ij
Package ij.gui

Class PlotCanvas

  • All Implemented Interfaces:
    java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.accessibility.Accessible

    public class PlotCanvas
    extends ImageCanvas
    This subclass of ImageCanvas has special provisions for plots: - Zooming: sets the plot range - Scrolling: moves data area This behavior is suppressed if the plot is frozen
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.awt.Canvas

        java.awt.Canvas.AccessibleAWTCanvas
      • Nested classes/interfaces inherited from class java.awt.Component

        java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
    • Constructor Summary

      Constructors 
      Constructor Description
      PlotCanvas​(ImagePlus imp)
      Creates a new PlotCanvas
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void fitToWindow()
      Resizes the plot (unless frozen) to fit the window
      Plot getPlot()
      Returns the Plot displayed in this canvas
      boolean isFrozen()
      Whether the plot is frozen, i.e.
      void mouseExited​(java.awt.event.MouseEvent e)
      overrides ImageCanvas.mouseExited; removes 'range' arrows
      void mousePressed​(java.awt.event.MouseEvent e)
      overrides ImageCanvas.mousePressed: no further processing of clicks on 'range' arrows
      void mouseReleased​(java.awt.event.MouseEvent e)
      Overrides ImageCanvas.mouseReleased, handles clicks on 'range' arrows
      protected void scroll​(int sx, int sy)
      overrides ImageCanvas.scroll; if plot is not frozen, scrolling modifies the plot data range
      void setMagnification​(double magnification)
      The image of a PlotCanvas is always shown at 100% magnification unless the plot is frozen
      void setPlot​(Plot plot)
      Tells the PlotCanvas which plot to use for zooming etc.
      void setSourceRect​(java.awt.Rectangle r)
      Scrolling a PlotCanvas is updating the plot, not viewing part of the plot, unless the plot is frozen
      protected void setupScroll​(int ox, int oy)
      overrides ImageCanvas.setupScroll; if plot is not frozen, scrolling modifies the plot data range
      void unzoom()
      Implements the Image/Zoom/Original Scale command.
      void zoom​(java.lang.String arg)
      Zoom operations that are handled by ij.plugin.Zoom
      void zoom100Percent()
      Implements the Image/Zoom/View 100% command: Sets the original frame size as specified in Edit/Options/Plots (unless the plot is frozen)
      void zoomIn​(int sx, int sy)
      Zooms in by modifying the plot range; sx and sy are screen coordinates
      void zoomOut​(int sx, int sy)
      Zooms out by modifying the plot range; sx and sy are screen coordinates
      • Methods inherited from class java.awt.Canvas

        addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy
      • Methods inherited from class java.awt.Component

        action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, revalidate, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setMixingCutoutShape, setName, setPreferredSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • PlotCanvas

        public PlotCanvas​(ImagePlus imp)
        Creates a new PlotCanvas
    • Method Detail

      • setPlot

        public void setPlot​(Plot plot)
        Tells the PlotCanvas which plot to use for zooming etc. Call this immediately after construction
      • getPlot

        public Plot getPlot()
        Returns the Plot displayed in this canvas
      • isFrozen

        public boolean isFrozen()
        Whether the plot is frozen, i.e. its ImageProcessor can not be changed
      • zoom

        public void zoom​(java.lang.String arg)
        Zoom operations that are handled by ij.plugin.Zoom
      • zoomIn

        public void zoomIn​(int sx,
                           int sy)
        Zooms in by modifying the plot range; sx and sy are screen coordinates
        Overrides:
        zoomIn in class ImageCanvas
      • zoomOut

        public void zoomOut​(int sx,
                            int sy)
        Zooms out by modifying the plot range; sx and sy are screen coordinates
        Overrides:
        zoomOut in class ImageCanvas
      • unzoom

        public void unzoom()
        Implements the Image/Zoom/Original Scale command. Sets the original range of the x, y axes (unless the plot is frozen)
        Overrides:
        unzoom in class ImageCanvas
      • zoom100Percent

        public void zoom100Percent()
        Implements the Image/Zoom/View 100% command: Sets the original frame size as specified in Edit/Options/Plots (unless the plot is frozen)
        Overrides:
        zoom100Percent in class ImageCanvas
      • fitToWindow

        public void fitToWindow()
        Resizes the plot (unless frozen) to fit the window
        Overrides:
        fitToWindow in class ImageCanvas
      • setMagnification

        public void setMagnification​(double magnification)
        The image of a PlotCanvas is always shown at 100% magnification unless the plot is frozen
        Overrides:
        setMagnification in class ImageCanvas
      • setSourceRect

        public void setSourceRect​(java.awt.Rectangle r)
        Scrolling a PlotCanvas is updating the plot, not viewing part of the plot, unless the plot is frozen
        Overrides:
        setSourceRect in class ImageCanvas
      • setupScroll

        protected void setupScroll​(int ox,
                                   int oy)
        overrides ImageCanvas.setupScroll; if plot is not frozen, scrolling modifies the plot data range
        Overrides:
        setupScroll in class ImageCanvas
      • scroll

        protected void scroll​(int sx,
                              int sy)
        overrides ImageCanvas.scroll; if plot is not frozen, scrolling modifies the plot data range
        Overrides:
        scroll in class ImageCanvas
      • mouseExited

        public void mouseExited​(java.awt.event.MouseEvent e)
        overrides ImageCanvas.mouseExited; removes 'range' arrows
        Specified by:
        mouseExited in interface java.awt.event.MouseListener
        Overrides:
        mouseExited in class ImageCanvas
      • mousePressed

        public void mousePressed​(java.awt.event.MouseEvent e)
        overrides ImageCanvas.mousePressed: no further processing of clicks on 'range' arrows
        Specified by:
        mousePressed in interface java.awt.event.MouseListener
        Overrides:
        mousePressed in class ImageCanvas
      • mouseReleased

        public void mouseReleased​(java.awt.event.MouseEvent e)
        Overrides ImageCanvas.mouseReleased, handles clicks on 'range' arrows
        Specified by:
        mouseReleased in interface java.awt.event.MouseListener
        Overrides:
        mouseReleased in class ImageCanvas