Documentation of 'japlot.jaxodraw.JaxoCanvas' Java class
JaxoCanvas
japlot.jaxodraw

Class JaxoCanvas

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


    public class JaxoCanvas
    extends javax.swing.JPanel
    implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.ComponentListener
    An instance of the canvas: responsible for all the drawing.
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class javax.swing.JComponent

        javax.swing.JComponent.AccessibleJComponent
      • Nested classes/interfaces inherited from class java.awt.Component

        java.awt.Component.BaselineResizeBehavior
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.awt.Color BCKG_COLOR
      The background color of the canvas.
      static int HANDLE_LL
      The lower left handle.
      static int HANDLE_LR
      The lower right handle.
      static int HANDLE_UL
      The upper left handle.
      static int HANDLE_UR
      The upper right handle.
      javax.swing.JMenuItem m_axes 
      javax.swing.JMenuItem m_clear 
      javax.swing.JMenuItem m_data 
      javax.swing.JMenuItem m_info 
      javax.swing.JMenuItem m_refresh 
      • 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 java.awt.image.ImageObserver

        ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
    • Constructor Summary

      Constructors 
      Constructor and Description
      JaxoCanvas(JaxoMainPanel mainPanel)
      Constructs a new canvas within the specified panel.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void clearOffScreenImage()
      Clears the offScreenImage.
      void componentHidden(java.awt.event.ComponentEvent e) 
      void componentMoved(java.awt.event.ComponentEvent e) 
      void componentResized(java.awt.event.ComponentEvent e) 
      void componentShown(java.awt.event.ComponentEvent e) 
      void dispose()
      Copies the offScreenImage to backupOffScreenImage.
      void drawVisualAid(boolean draw)
      Sets the visual aid to draw or not.
      void drawWithHandles(boolean draw)
      Sets handles to draw or not.
      java.awt.Color getBackgroundBox() 
      JaxoGraph getCanvasGraph()
      Returns the current graph.
      java.lang.String getCanvasTick()
      Returns the current tick.
      int getDragMode()
      Returns the current drag mode.
      int getGridSize()
      Returns the current size of the grid.
      boolean getGridType()
      Returns the current type of the grid.
      java.awt.Image getOffScreenImage()
      Returns the current offScreenImage.
      double[] getOldbb()
      Returns the old bounding box of the object.
      boolean hasBeenUsed()
      Indicates whether the current canvas has been used.
      boolean isWithHandles()
      Indicates whether handles are drawn.
      boolean isWithVisualAid()
      Indicates whether the visual aid is drawn.
      void mouseClicked(java.awt.event.MouseEvent e)
      The action to be taken when the mouse is clicked on the canvas.
      void mouseDragged(java.awt.event.MouseEvent e)
      The action to be taken when the mouse is dragged on the canvas.
      void mouseEntered(java.awt.event.MouseEvent e)
      The action to be taken when the mouse enters the canvas.
      void mouseExited(java.awt.event.MouseEvent e)
      The action to be taken when the mouse exits the canvas.
      void mouseMoved(java.awt.event.MouseEvent e)
      The action to be taken when the mouse is moved on the canvas.
      void mousePressed(java.awt.event.MouseEvent e)
      The action to be taken when the mouse is pressed on the canvas.
      void mouseReleased(java.awt.event.MouseEvent e)
      The action to be taken when the mouse is released on the canvas.
      void paintComponent(java.awt.Graphics g)
      Paints the canvas.
      void resetNOfClicks()
      When drawing arc objects: resets the number of clicks to zero.
      void saveBackupImage()
      Copies the offScreenImage to backupOffScreenImage.
      void setBackgroundBox(java.awt.Color c) 
      void setCanvasGraph(JaxoGraph theGraph)
      Sets the current graph.
      void setCanvasTick(java.lang.String theTick)
      Sets the current tick.
      void setDragMode(int newDragMode)
      Sets the current drag mode.
      void setGridSize(int gs)
      Sets the size of the grid to the given value.
      void setGridType(boolean type)
      Sets the type of the grid.
      void setLanguage(java.lang.String languageString)
      Sets the text in different languages.
      void setOldbb(double[] bb)
      Sets the old bounding box of the object.
      void showCoordinates(java.awt.event.MouseEvent e)
      Show mouse coordinates
      void swapImages()
      Swaps the current offScreenImage with the backupImage.
      void unsavedCanvas()
      Indicates that the canvas contains a graph that is not saved.
      void update()
      Redraw all components
      void update(java.awt.Graphics g)
      Updates the canvas by just calling paintComponent.
      void updateLocations() 
      void updateObjectLocation() 
      void updateOffScreenImage()
      Updates the offScreenImage within the current clipping area.
      void updateOffScreenImage(JaObject selectedOb)
      Updates the offScreenImage without drawing selectedOb.
      • Methods inherited from class javax.swing.JPanel

        getAccessibleContext, getUI, getUIClassID, setUI, updateUI
      • 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, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, 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
      • Methods inherited from class java.awt.Container

        add, add, add, add, add, addContainerListener, addPropertyChangeListener, 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, remove, removeAll, 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, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • BCKG_COLOR

        public static java.awt.Color BCKG_COLOR
        The background color of the canvas.
      • m_info

        public javax.swing.JMenuItem m_info
      • m_data

        public javax.swing.JMenuItem m_data
      • m_axes

        public javax.swing.JMenuItem m_axes
      • m_refresh

        public javax.swing.JMenuItem m_refresh
      • m_clear

        public javax.swing.JMenuItem m_clear
    • Constructor Detail

      • JaxoCanvas

        public JaxoCanvas(JaxoMainPanel mainPanel)
        Constructs a new canvas within the specified panel.
        Parameters:
        mainPanel - An instance of the main panel.
    • Method Detail

      • setCanvasGraph

        public final void setCanvasGraph(JaxoGraph theGraph)
        Sets the current graph.
        Parameters:
        theGraph - The graph to be set.
      • getCanvasGraph

        public final JaxoGraph getCanvasGraph()
        Returns the current graph.
        Returns:
        The current graph.
      • setCanvasTick

        public final void setCanvasTick(java.lang.String theTick)
        Sets the current tick.
        Parameters:
        theTick - The current tick.
      • getCanvasTick

        public final java.lang.String getCanvasTick()
        Returns the current tick.
        Returns:
        The current tick.
      • getDragMode

        public final int getDragMode()
        Returns the current drag mode.
        Returns:
        The current drag mode.
      • setDragMode

        public final void setDragMode(int newDragMode)
        Sets the current drag mode.
        Parameters:
        newDragMode - The drag mode to be set.
      • getOldbb

        public final double[] getOldbb()
        Returns the old bounding box of the object.
        Returns:
        The bounding box of the object befor dragging.
      • setOldbb

        public final void setOldbb(double[] bb)
        Sets the old bounding box of the object.
        Parameters:
        bb - The old bounding box of the object
      • update

        public final void update(java.awt.Graphics g)
        Updates the canvas by just calling paintComponent.
        Overrides:
        update in class javax.swing.JComponent
        Parameters:
        g - The specified graphics context.
      • paintComponent

        public final void paintComponent(java.awt.Graphics g)
        Paints the canvas.
        Overrides:
        paintComponent in class javax.swing.JComponent
        Parameters:
        g - The specified graphics context.
      • getOffScreenImage

        public final java.awt.Image getOffScreenImage()
        Returns the current offScreenImage.
        Returns:
        The current offScreenImage.
      • setBackgroundBox

        public void setBackgroundBox(java.awt.Color c)
      • getBackgroundBox

        public java.awt.Color getBackgroundBox()
      • dispose

        public final void dispose()
        Copies the offScreenImage to backupOffScreenImage.
      • saveBackupImage

        public final void saveBackupImage()
        Copies the offScreenImage to backupOffScreenImage.
      • swapImages

        public final void swapImages()
        Swaps the current offScreenImage with the backupImage.
      • clearOffScreenImage

        public final void clearOffScreenImage()
        Clears the offScreenImage.
      • updateOffScreenImage

        public final void updateOffScreenImage()
        Updates the offScreenImage within the current clipping area.
      • updateOffScreenImage

        public final void updateOffScreenImage(JaObject selectedOb)
        Updates the offScreenImage without drawing selectedOb.
        Parameters:
        selectedOb - The JaObject to be excluded from the update.
      • showCoordinates

        public final void showCoordinates(java.awt.event.MouseEvent e)
        Show mouse coordinates
        Parameters:
        e - The corresponding mouse event.
      • mouseClicked

        public final void mouseClicked(java.awt.event.MouseEvent e)
        The action to be taken when the mouse is clicked on the canvas.
        Specified by:
        mouseClicked in interface java.awt.event.MouseListener
        Parameters:
        e - The corresponding mouse event.
      • mousePressed

        public final void mousePressed(java.awt.event.MouseEvent e)
        The action to be taken when the mouse is pressed on the canvas.
        Specified by:
        mousePressed in interface java.awt.event.MouseListener
        Parameters:
        e - The corresponding mouse event.
      • mouseDragged

        public final void mouseDragged(java.awt.event.MouseEvent e)
        The action to be taken when the mouse is dragged on the canvas.
        Specified by:
        mouseDragged in interface java.awt.event.MouseMotionListener
        Parameters:
        e - The corresponding mouse event.
      • mouseReleased

        public final void mouseReleased(java.awt.event.MouseEvent e)
        The action to be taken when the mouse is released on the canvas.
        Specified by:
        mouseReleased in interface java.awt.event.MouseListener
        Parameters:
        e - The corresponding mouse event.
      • mouseExited

        public final void mouseExited(java.awt.event.MouseEvent e)
        The action to be taken when the mouse exits the canvas.
        Specified by:
        mouseExited in interface java.awt.event.MouseListener
        Parameters:
        e - The corresponding mouse event.
      • mouseEntered

        public final void mouseEntered(java.awt.event.MouseEvent e)
        The action to be taken when the mouse enters the canvas.
        Specified by:
        mouseEntered in interface java.awt.event.MouseListener
        Parameters:
        e - The corresponding mouse event.
      • mouseMoved

        public final void mouseMoved(java.awt.event.MouseEvent e)
        The action to be taken when the mouse is moved on the canvas.
        Specified by:
        mouseMoved in interface java.awt.event.MouseMotionListener
        Parameters:
        e - The corresponding mouse event.
      • update

        public void update()
        Redraw all components
      • setGridSize

        public final void setGridSize(int gs)
        Sets the size of the grid to the given value.
        Parameters:
        gs - The grid size to be set.
      • getGridSize

        public final int getGridSize()
        Returns the current size of the grid.
        Returns:
        The grid size.
      • setGridType

        public final void setGridType(boolean type)
        Sets the type of the grid.
        Parameters:
        type - The type of the grid to be set.
      • getGridType

        public final boolean getGridType()
        Returns the current type of the grid.
        Returns:
        The type of the grid.
      • unsavedCanvas

        public final void unsavedCanvas()
        Indicates that the canvas contains a graph that is not saved.
      • hasBeenUsed

        public final boolean hasBeenUsed()
        Indicates whether the current canvas has been used.
        Returns:
        True, if the canvas has been modified, false otherwise.
      • isWithHandles

        public final boolean isWithHandles()
        Indicates whether handles are drawn.
        Returns:
        True, if handles are drawn, false otherwise.
      • drawWithHandles

        public final void drawWithHandles(boolean draw)
        Sets handles to draw or not.
        Parameters:
        draw - True, if handles should be drawn, false otherwise.
      • isWithVisualAid

        public final boolean isWithVisualAid()
        Indicates whether the visual aid is drawn.
        Returns:
        True, if the visual aid is drawn, false otherwise.
      • drawVisualAid

        public final void drawVisualAid(boolean draw)
        Sets the visual aid to draw or not.
        Parameters:
        draw - True, if the visual aid should be drawn, false otherwise.
      • setLanguage

        public final void setLanguage(java.lang.String languageString)
        Sets the text in different languages.
        Parameters:
        languageString - A string specifying the language to be set.
      • resetNOfClicks

        public final void resetNOfClicks()
        When drawing arc objects: resets the number of clicks to zero.
      • updateObjectLocation

        public void updateObjectLocation()
      • updateLocations

        public void updateLocations()
      • componentResized

        public void componentResized(java.awt.event.ComponentEvent e)
        Specified by:
        componentResized in interface java.awt.event.ComponentListener
      • componentMoved

        public void componentMoved(java.awt.event.ComponentEvent e)
        Specified by:
        componentMoved in interface java.awt.event.ComponentListener
      • componentShown

        public void componentShown(java.awt.event.ComponentEvent e)
        Specified by:
        componentShown in interface java.awt.event.ComponentListener
      • componentHidden

        public void componentHidden(java.awt.event.ComponentEvent e)
        Specified by:
        componentHidden in interface java.awt.event.ComponentListener

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.