ac.essex.graphing.swing
Class GraphPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by ac.essex.graphing.plotting.Graph
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class GraphPanel
extends javax.swing.JPanel

Graph Panel A JPanel for use in Swing GUI interfaces that can draw various mathematical functions, which implement the GraphableFunction Interface

There are a number of different settings that can be changed to alter the appearance and behaviour of the Graph Panel. Have a look at the Getter and Setter methods for more details.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version, provided that any use properly credits the author. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details at http://www.gnu.org

Version:
1.0
Author:
Olly Oechsle, University of Essex
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Field Summary
 
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
GraphPanel(ac.essex.graphing.plotting.ContinuousFunctionPlotter function)
          Simplest constructor, initialises the Graph Panel with the mathematical function to implement.
GraphPanel(ac.essex.graphing.plotting.ContinuousFunctionPlotter function, double xMin, double xMax, double yMin, double yMax)
           
 
Method Summary
 java.awt.Color getAxisColor()
           
 java.awt.Color getBackgroundColor()
           
 int getBorderBottom()
           
 int getBorderLeft()
           
 int getBorderRight()
           
 int getBorderTop()
           
 java.awt.Color getFontColor()
           
 ac.essex.graphing.plotting.ContinuousFunctionPlotter getFunction()
          Gets the function class used to generate the graph.
 java.awt.Color getGridColor()
           
 double getMaxX()
          Gets the maximum X value for plotting.
 double getMaxY()
          Gets the maximum Y value for plotting
 double getMinX()
          Gets the minimum X value for plotting
 double getMinY()
          Gets the minimum Y value for plotting
 int getNotchCountX()
           
 int getNotchCountY()
           
 int getNotchGap()
           
 int getNotchSize()
           
 java.text.Format getNumberFormatter()
           
 java.awt.Color getPlotColor()
           
 boolean isHorizontalGridVisible()
           
 boolean isVerticalGridVisible()
           
 void paint(java.awt.Graphics g)
           
 void setAxisColor(java.awt.Color axisColor)
           
 void setBackgroundColor(java.awt.Color backgroundColor)
           
 void setBorderBottom(int borderBottom)
           
 void setBorderLeft(int borderLeft)
           
 void setBorderRight(int borderRight)
           
 void setBorderTop(int borderTop)
           
 void setFontColor(java.awt.Color fontColor)
           
 void setFunction(ac.essex.graphing.plotting.ContinuousFunctionPlotter function)
          Sets the function class used to generate the graph.
 void setGridColor(java.awt.Color gridColor)
           
 void setHorizontalGridVisible(boolean horizontalGridVisible)
           
 void setMaxX(double maxX)
          Sets the maximum X value for plotting.
 void setMaxY(double maxY)
          Sets the maximum Y value for plotting
 void setMinX(double minX)
          Sets the minimum X value for plotting.
 void setMinY(double minY)
          Sets the minimum Y value for plotting
 void setNotchCountX(int notchCountX)
           
 void setNotchCountY(int notchCountY)
           
 void setNotchGap(int notchGap)
           
 void setNotchSize(int notchSize)
           
 void setNumberFormatter(java.text.Format numberFormatter)
           
 void setPlotColor(java.awt.Color plotColor)
           
 void setVerticalGridVisible(boolean verticalGridVisible)
           
 
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, 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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, 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
 
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, transferFocusBackward, 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, hide, 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, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GraphPanel

public GraphPanel(ac.essex.graphing.plotting.ContinuousFunctionPlotter function)
Simplest constructor, initialises the Graph Panel with the mathematical function to implement.


GraphPanel

public GraphPanel(ac.essex.graphing.plotting.ContinuousFunctionPlotter function,
                  double xMin,
                  double xMax,
                  double yMin,
                  double yMax)
Method Detail

paint

public void paint(java.awt.Graphics g)
Overrides:
paint in class javax.swing.JComponent

getMinX

public double getMinX()
Gets the minimum X value for plotting


setMinX

public void setMinX(double minX)
Sets the minimum X value for plotting.


getMaxX

public double getMaxX()
Gets the maximum X value for plotting.


setMaxX

public void setMaxX(double maxX)
Sets the maximum X value for plotting.


getMinY

public double getMinY()
Gets the minimum Y value for plotting


setMinY

public void setMinY(double minY)
Sets the minimum Y value for plotting


getMaxY

public double getMaxY()
Gets the maximum Y value for plotting


setMaxY

public void setMaxY(double maxY)
Sets the maximum Y value for plotting


getFunction

public ac.essex.graphing.plotting.ContinuousFunctionPlotter getFunction()
Gets the function class used to generate the graph.


setFunction

public void setFunction(ac.essex.graphing.plotting.ContinuousFunctionPlotter function)
Sets the function class used to generate the graph.


getBorderTop

public int getBorderTop()

setBorderTop

public void setBorderTop(int borderTop)

getBorderBottom

public int getBorderBottom()

setBorderBottom

public void setBorderBottom(int borderBottom)

getBorderLeft

public int getBorderLeft()

setBorderLeft

public void setBorderLeft(int borderLeft)

getBorderRight

public int getBorderRight()

setBorderRight

public void setBorderRight(int borderRight)

getAxisColor

public java.awt.Color getAxisColor()

setAxisColor

public void setAxisColor(java.awt.Color axisColor)

getFontColor

public java.awt.Color getFontColor()

setFontColor

public void setFontColor(java.awt.Color fontColor)

getBackgroundColor

public java.awt.Color getBackgroundColor()

setBackgroundColor

public void setBackgroundColor(java.awt.Color backgroundColor)

getPlotColor

public java.awt.Color getPlotColor()

setPlotColor

public void setPlotColor(java.awt.Color plotColor)

getGridColor

public java.awt.Color getGridColor()

setGridColor

public void setGridColor(java.awt.Color gridColor)

getNotchSize

public int getNotchSize()

setNotchSize

public void setNotchSize(int notchSize)

getNotchGap

public int getNotchGap()

setNotchGap

public void setNotchGap(int notchGap)

isHorizontalGridVisible

public boolean isHorizontalGridVisible()

setHorizontalGridVisible

public void setHorizontalGridVisible(boolean horizontalGridVisible)

isVerticalGridVisible

public boolean isVerticalGridVisible()

setVerticalGridVisible

public void setVerticalGridVisible(boolean verticalGridVisible)

getNumberFormatter

public java.text.Format getNumberFormatter()

setNumberFormatter

public void setNumberFormatter(java.text.Format numberFormatter)

getNotchCountX

public int getNotchCountX()

setNotchCountX

public void setNotchCountX(int notchCountX)

getNotchCountY

public int getNotchCountY()

setNotchCountY

public void setNotchCountY(int notchCountY)