Class ViewJComponentFunct

  • All Implemented Interfaces:
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

    public class ViewJComponentFunct
    extends javax.swing.JComponent
    This is a custom made Swing component. It is coordinates for the ViewJComponentGraph as well as the line color. The graph then uses this information to draw the function.
    Version:
    1.0 Jun 1, 1999
    Author:
    Neva Cherniavsky
    See Also:
    ViewJComponentGraph, 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.Container

        java.awt.Container.AccessibleAWTContainer
      • 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
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String functName
      DOCUMENT ME!
      private java.awt.Color lineColor
      DOCUMENT ME!
      static int MAX_NUM_COORDS
      Maximum size of the coordinate arrays.
      private int[] newX
      DOCUMENT ME!
      private int newXLength
      DOCUMENT ME!
      private int[] newY
      DOCUMENT ME!
      private int newYLength
      DOCUMENT ME!
      private float[] originalX
      DOCUMENT ME!
      private float[] originalY
      DOCUMENT ME!
      private static long serialVersionUID
      Use serialVersionUID for interoperability.
      private boolean showFitFunction
      DOCUMENT ME!
      private boolean showFunction
      DOCUMENT ME!
      private VOI voi
      DOCUMENT ME!
      float[] X
      DOCUMENT ME!
      int[][] XYCoords
      xy coordinates of voi boundar
      float[] Y
      DOCUMENT ME!
      • Fields inherited from class javax.swing.JComponent

        listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • Fields inherited from class java.awt.Component

        accessibleContext, 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 Description
      ViewJComponentFunct()
      Constructor - creates empty function.
      ViewJComponentFunct​(float[] x, float[] y, int name, VOI v, int[][] xyCoords)
      Constructor - creates functions with specified coordinates, and number for name.
      ViewJComponentFunct​(float[] x, float[] y, java.awt.Color lineColor, int name, VOI v, int[][] xyCoords)
      Constructor - creates functions with specified coordinates, color, and number for name.
      ViewJComponentFunct​(float[] x, float[] y, java.awt.Color lineColor, VOI v, int[][] xyCoords)
      Constructor - creates functions with specified coordinates and color.
      ViewJComponentFunct​(float[] x, float[] y, java.awt.Color lineColor, java.lang.String name, VOI v)
      Constructor - creates functions with specified coordinates, color, and name string.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.awt.Color getColor()
      getColor - gets the color of the line on the graph.
      boolean getFitFunctionVisible()
      getFitFunctionVisible - accessor that gets the visible flag of the fitted function.
      boolean getFunctionVisible()
      getFunctionVisible - accessor that gets the visible flag of the function.
      java.lang.String getFunctName()
      getFunctNames - gets the names of the functions.
      int[] getNewXs()
      getNewXs - accessor that gets the array of x coordinates to be plotted; used by the graphics for the actual plotting of the graph.
      int getNewXsLength()
      Accessor that gets the number of x coordinates to be plotted.
      int[] getNewYs()
      getNewYs - accessor that gets the array of y coordinates to be plotted used by the graphics for the actual plotting of the graph.
      int getNewYsLength()
      Accessor that gets the number of y coordinates to be plotted.
      float[] getOriginalXs()
      getOriginalXs - accessor that gets the array of x coordinates to be plotted; used by the zoom to reset the graph.
      float[] getOriginalYs()
      getOriginalYs - accessor that gets the array of y coordinates to be plotted used by the zoom for the rest of the graph.
      VOI getVOI()
      gets the voi associated with this function if it corresponds to a point, otherwise returns null.
      float[] getXs()
      getXs - accessor that gets the array of x coordinates to be plotted.
      int[][] getXYCoords()  
      float[] getYs()
      getYs - accessor that gets the array of y coordinates to be plotted.
      void setColor​(int color)
      setColor - sets the color of the line on the graph.
      void setColor​(java.awt.Color color)
      setColor - sets the color of the line on the graph.
      void setFitFunctionVisible​(boolean visible)
      setFitFunctionVisible - accessor that tells whether to show the fitted function.
      void setFunctionVisible​(boolean visible)
      setFunctionVisible - accessor that tells whether to show the function.
      void setFunctName​(int i)
      setFunctName - sets the names of the functions to default names (function + number).
      void setFunctName​(java.lang.String name)
      setFunctName - sets the names of the functons.
      void setNewXs​(int[] oldX, int len)
      setNewXs - accessor that sets the integer array of x coordinates to be plotted; used by the graphics for the actual plotting of the graph.
      void setNewYs​(int[] oldY, int len)
      setNewYs - accessor that sets the integer array of y coordinates to be plotted; used by the graphics for the actual plotting of the graph.
      void setOriginalXs​(float[] oldX)
      setOriginalXs - accessor that sets the array of x coordinates to be plotted; used by the zoom to reset the graph.
      void setOriginalYs​(float[] oldY)
      setOriginalYs - accessor that sets the array of y coordinates to be plotted; used by the zoom for reseting the graph.
      void setXs​(float[] oldX)
      setXs - accessor that sets the array of x coordinates to be plotted.
      void setYs​(float[] oldY)
      setYs - accessor that sets the array of y coordinates to be plotted.
      • Methods inherited from class javax.swing.JComponent

        addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, 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, getUI, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, 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, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
      • Methods inherited from class java.awt.Container

        add, add, add, add, add, addContainerListener, addImpl, 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, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • Methods inherited from class java.awt.Component

        action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, 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, 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, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • Methods inherited from class java.lang.Object

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

      • serialVersionUID

        private static final long serialVersionUID
        Use serialVersionUID for interoperability.
        See Also:
        Constant Field Values
      • MAX_NUM_COORDS

        public static final int MAX_NUM_COORDS
        Maximum size of the coordinate arrays.
        See Also:
        Constant Field Values
      • X

        public float[] X
        DOCUMENT ME!
      • Y

        public float[] Y
        DOCUMENT ME!
      • XYCoords

        public int[][] XYCoords
        xy coordinates of voi boundar
      • functName

        private java.lang.String functName
        DOCUMENT ME!
      • lineColor

        private java.awt.Color lineColor
        DOCUMENT ME!
      • newX

        private int[] newX
        DOCUMENT ME!
      • newXLength

        private int newXLength
        DOCUMENT ME!
      • newY

        private int[] newY
        DOCUMENT ME!
      • newYLength

        private int newYLength
        DOCUMENT ME!
      • originalX

        private float[] originalX
        DOCUMENT ME!
      • originalY

        private float[] originalY
        DOCUMENT ME!
      • showFitFunction

        private boolean showFitFunction
        DOCUMENT ME!
      • showFunction

        private boolean showFunction
        DOCUMENT ME!
      • voi

        private VOI voi
        DOCUMENT ME!
    • Constructor Detail

      • ViewJComponentFunct

        public ViewJComponentFunct()
        Constructor - creates empty function.
      • ViewJComponentFunct

        public ViewJComponentFunct​(float[] x,
                                   float[] y,
                                   java.awt.Color lineColor,
                                   VOI v,
                                   int[][] xyCoords)
        Constructor - creates functions with specified coordinates and color.
        Parameters:
        x - x coordinates of the function
        y - y coordinates of the function
        lineColor - color for the function
        v - voi this is drawn for if it is for a point, should be null otherwise
      • ViewJComponentFunct

        public ViewJComponentFunct​(float[] x,
                                   float[] y,
                                   int name,
                                   VOI v,
                                   int[][] xyCoords)
        Constructor - creates functions with specified coordinates, and number for name.
        Parameters:
        x - x coordinates of the function
        y - y coordinates of the function
        name - integer for name of function
        v - voi this is drawn for if it is for a point, should be null otherwise
      • ViewJComponentFunct

        public ViewJComponentFunct​(float[] x,
                                   float[] y,
                                   java.awt.Color lineColor,
                                   java.lang.String name,
                                   VOI v)
        Constructor - creates functions with specified coordinates, color, and name string.
        Parameters:
        x - x coordinates of the function
        y - y coordinates of the function
        lineColor - color for the function
        name - name of function
        v - voi this is drawn for if it is for a point, should be null otherwise
      • ViewJComponentFunct

        public ViewJComponentFunct​(float[] x,
                                   float[] y,
                                   java.awt.Color lineColor,
                                   int name,
                                   VOI v,
                                   int[][] xyCoords)
        Constructor - creates functions with specified coordinates, color, and number for name.
        Parameters:
        x - x coordinates of the function
        y - y coordinates of the function
        lineColor - color for the function
        name - integer for name of function
        v - voi this is drawn for if it is for a point, should be null otherwise
    • Method Detail

      • getColor

        public java.awt.Color getColor()
        getColor - gets the color of the line on the graph.
        Returns:
        color of the line on the graph
      • getFitFunctionVisible

        public boolean getFitFunctionVisible()
        getFitFunctionVisible - accessor that gets the visible flag of the fitted function.
        Returns:
        the boolean visible flag
      • getFunctionVisible

        public boolean getFunctionVisible()
        getFunctionVisible - accessor that gets the visible flag of the function.
        Returns:
        the boolean visible flag
      • getFunctName

        public java.lang.String getFunctName()
        getFunctNames - gets the names of the functions.
        Returns:
        names of the functions
      • getNewXs

        public int[] getNewXs()
        getNewXs - accessor that gets the array of x coordinates to be plotted; used by the graphics for the actual plotting of the graph.
        Returns:
        the array of x coordinates
      • getNewXsLength

        public int getNewXsLength()
        Accessor that gets the number of x coordinates to be plotted.
        Returns:
        DOCUMENT ME!
      • getNewYs

        public int[] getNewYs()
        getNewYs - accessor that gets the array of y coordinates to be plotted used by the graphics for the actual plotting of the graph.
        Returns:
        the array of y coordinates
      • getNewYsLength

        public int getNewYsLength()
        Accessor that gets the number of y coordinates to be plotted.
        Returns:
        DOCUMENT ME!
      • getOriginalXs

        public float[] getOriginalXs()
        getOriginalXs - accessor that gets the array of x coordinates to be plotted; used by the zoom to reset the graph.
        Returns:
        the array of x coordinates
      • getOriginalYs

        public float[] getOriginalYs()
        getOriginalYs - accessor that gets the array of y coordinates to be plotted used by the zoom for the rest of the graph.
        Returns:
        the array of y coordinates
      • getVOI

        public VOI getVOI()
        gets the voi associated with this function if it corresponds to a point, otherwise returns null.
        Returns:
        DOCUMENT ME!
      • getXs

        public float[] getXs()
        getXs - accessor that gets the array of x coordinates to be plotted.
        Returns:
        the array of x coordinates
      • getXYCoords

        public int[][] getXYCoords()
      • getYs

        public float[] getYs()
        getYs - accessor that gets the array of y coordinates to be plotted.
        Returns:
        the array of y coordinates
      • setColor

        public void setColor​(java.awt.Color color)
        setColor - sets the color of the line on the graph.
        Parameters:
        color - color to set the line to
      • setColor

        public void setColor​(int color)
        setColor - sets the color of the line on the graph.
        Parameters:
        color - code for the color to set the line to
      • setFitFunctionVisible

        public void setFitFunctionVisible​(boolean visible)
        setFitFunctionVisible - accessor that tells whether to show the fitted function.
        Parameters:
        visible - boolean to set it to
      • setFunctionVisible

        public void setFunctionVisible​(boolean visible)
        setFunctionVisible - accessor that tells whether to show the function.
        Parameters:
        visible - boolean to set it to
      • setFunctName

        public void setFunctName​(java.lang.String name)
        setFunctName - sets the names of the functons.
        Parameters:
        name - - String of function name
      • setFunctName

        public void setFunctName​(int i)
        setFunctName - sets the names of the functions to default names (function + number).
        Parameters:
        i - - number of functions
      • setNewXs

        public void setNewXs​(int[] oldX,
                             int len)
        setNewXs - accessor that sets the integer array of x coordinates to be plotted; used by the graphics for the actual plotting of the graph.
        Parameters:
        oldX - the array of x coordinates
        len - number of coordinates
      • setNewYs

        public void setNewYs​(int[] oldY,
                             int len)
        setNewYs - accessor that sets the integer array of y coordinates to be plotted; used by the graphics for the actual plotting of the graph.
        Parameters:
        oldY - the array of y coordinates
        len - the number of y coordinates
      • setOriginalXs

        public void setOriginalXs​(float[] oldX)
        setOriginalXs - accessor that sets the array of x coordinates to be plotted; used by the zoom to reset the graph.
        Parameters:
        oldX - the array of x coordinates
      • setOriginalYs

        public void setOriginalYs​(float[] oldY)
        setOriginalYs - accessor that sets the array of y coordinates to be plotted; used by the zoom for reseting the graph.
        Parameters:
        oldY - the array of y coordinates
      • setXs

        public void setXs​(float[] oldX)
        setXs - accessor that sets the array of x coordinates to be plotted.
        Parameters:
        oldX - the array of x coordinates
      • setYs

        public void setYs​(float[] oldY)
        setYs - accessor that sets the array of y coordinates to be plotted.
        Parameters:
        oldY - the array of y coordinates