Package gov.nih.mipav.view
Class ViewJComponentGraph
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
gov.nih.mipav.view.ViewJComponentGraph
- All Implemented Interfaces:
MouseListener,MouseMotionListener,ImageObserver,MenuContainer,Serializable,EventListener
This is a custom made Swing component. It is a graph that takes a panel in the constructor and then draws itself. The
graph has the option of labels for the x and y axis, which are set with an accessor. Gridlines can also be turned on
and off. The function calling ViewJComponentGraph may specify a number of gridlines to have on the graph. The number
of gridlines is the same as the number of tick marks. Points are plotted in the graph by calling an accessor with an
array of x coordinates and an array of y coordinates. The number of coordinates in each array must be equal.
- Version:
- 0.1 Aug 1, 1998
- Author:
- Neva Cherniavsky (primary), Harman Singh
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate ColorDOCUMENT ME!private RectangleDOCUMENT ME!private static ViewJComponentFunctDOCUMENT ME!private static StringDOCUMENT ME!private static float[]DOCUMENT ME!private static float[]DOCUMENT ME!private CursorDOCUMENT ME!private CursorDOCUMENT ME!private floatDOCUMENT ME!private floatDOCUMENT ME!private floatDOCUMENT ME!private floatDOCUMENT ME!private booleanprivate booleanprivate ViewJComponentFunct[]DOCUMENT ME!private FontDOCUMENT ME!private FontDOCUMENT ME!private FontDOCUMENT ME!private ImageIconDOCUMENT ME!private ImageIconDOCUMENT ME!private ImageIconDOCUMENT ME!private ImageIconDOCUMENT ME!private ImageIconDOCUMENT ME!private ImageIconDOCUMENT ME!private ImageIconDOCUMENT ME!private ImageIconDOCUMENT ME!private ViewJComponentFunct[]DOCUMENT ME!private RectangleDOCUMENT ME!static final intMaximum number of functions that the graph may display.private floatDOCUMENT ME!private floatDOCUMENT ME!private floatDOCUMENT ME!private floatDOCUMENT ME!private int[]DOCUMENT ME!private int[]DOCUMENT ME!private RectangleDOCUMENT ME!private JFrameDOCUMENT ME!private RubberbandRectangleDOCUMENT ME!private static final longUse serialVersionUID for interoperability.static final intstatic final intstatic final intprivate booleanDOCUMENT ME!private booleanDOCUMENT ME!private booleanDOCUMENT ME!private booleanDOCUMENT ME!private booleanDOCUMENT ME!private intDOCUMENT ME!private StringDOCUMENT ME!private booleanprivate booleanprivate intDOCUMENT ME!private int[]private StringDOCUMENT ME!private doubleDOCUMENT ME!private doubleDOCUMENT ME!private intDOCUMENT ME!private int[]private intprivate StringDOCUMENT ME!private doubleDOCUMENT ME!private doubleDOCUMENT ME!private booleanprivate booleanFields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
ConstructorsConstructorDescriptionViewJComponentGraph(JFrame frame, int width, int height) Constructor - creates graph within the JPanel using graphics. -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidCalculates the range and domain (according to min and max y values). and expands range if necessary.voidCalculates the default range and domain (according to min and max x and y values).voidcopyFunct(int index) Copies the indicated function's properties, to be pasted later as a new function.voiddeleteFunct(int index) Deletes the indicated function.private doubledistance(int x1, int y1, int x2, int y2) Tests the distance between two points.voidvoiddrawString(Graphics g, String str, int x, int y) Accessor that gets the background color.Accessor that returns the bounds of the component.floatReturns the default maximum point for the domain (previously calculated).floatReturns the default maximum point for the range (previously calculated).floatReturns the default minimum point for the domain (previously calculated).floatReturns the default minimum point for the range (previously calculated).booleanAccessor that gets the visible flag.Accessor that gets the fitted functions for this graph.booleanAccessor that gets the visible flag of the functions.Accessor that gets the functions for this graph.booleanAccessor that gets the visible flag.booleanAccessor that gets the visible flag.floatfloatReturns the current maximum point for the range.floatAccessor that returns the minimum size of this component.booleanAccessor that gets the visible flag.floatReturns the current minimum point for the range.intAccessor that gets the number of gridlines for paint.intAccessor that gets the number of gridlines for paint.intAccessor that gets the visible flag.Accessor that returns the preferred size of the component.getTitle()Gets the title for the graph.Gets the label for the x axis.Gets the label for the y axis.private StringmakeString(float number, int decPts) Makes a string of a float with a specific number of decimal points.voidmouseClicked(MouseEvent mouseEvent) DOCUMENT ME!voidmouseDragged(MouseEvent mouseEvent) ******************* Mouse Motion Events ***************************.********************************************* ***********************voidmouseEntered(MouseEvent mouseEvent) ************************ Mouse Events *****************************.********************************************* ***********************voidmouseExited(MouseEvent mouseEvent) DOCUMENT ME!voidmouseMoved(MouseEvent mouseEvent) Changes the cursor to crosshair and enables the zoom box rubberband if the cursor is in the graph; also sees if cursor is near a valid point and prints it out.voidmousePressed(MouseEvent mouseEvent) DOCUMENT ME!voidmouseReleased(MouseEvent mouseEvent) Checks to see that the zoom box is valid, then redraws the graph using the zoom box as bounds.voidPaints the graph.voidPaints the graph for the Printer.voidAdds the previously copied copied function to the graph.voidPlots the graph by calling PolyLine.private voidSame as the plotGraph method, except the points used in this method are readable when sent to the printer.private voidvoidredrawGraph(Rectangle newBounds) Redraws the graph based on the new bounds.voidresetBounds(Rectangle rect) Sets the bounds of the component.voidsetAddSchwarzChristoffelLines(boolean addSchwarzChristoffelLines) voidsetBackgroundColor(Color color) Accessor that sets the background color to paint.voidSets range and domain to defaults.voidsetDoLogX(boolean doLogX) voidsetDoLogY(boolean doLogY) voidsetDomain(float min, float max) Sets the domain of the graph according to the min and max parmaters.voidsetFittedFunctionsVisible(boolean visible) Accessor that tells whether to show the gridlines.voidsetFittedFuncts(ViewJComponentFunct[] functs) Accessor that sets the fitted functions for this graph.voidsetFunctionsVisible(boolean visible) Accessor that tells whether to show the functions.voidsetFuncts(ViewJComponentFunct[] functs) Accessor that sets the function for this graph.voidsetGridlinesVisible(boolean visible) Accessor that tells whether to show the gridlines.voidSets the labels for the x and y axis to these strings.voidSets the y axis label to yStrvoidsetLegendVisible(boolean visible) Accessor that tells whether to show the legend.voidsetMinorTickMarksVisible(boolean visible) Accessor that tells whether to show the minor tick marks.voidsetNumberOfXGridLines(int xGrid) Accessor that sets the number of gridlines for paint.voidsetNumberOfYGridLines(int yGrid) Accessor that sets the number of gridlines for paint.voidsetPointsAndLinesDisplay(int showPointsAndLines) Accessor that sets whether to display lines only, points and lines, or points onlyvoidsetRange(float min, float max) Sets the range of the graph according to the min and max parmaters.voidDOCUMENT ME!voidSets the title to this string.voidsetUserXGrid(boolean userXGrid) voidsetUserYGrid(boolean userYGrid) voidsetX1Vector(Vector<Double> x1Vector) voidsetX2Vector(Vector<Double> x2Vector) voidsetXGridUserPositions(int[] xGridUserPositions) voidsetY1Vector(Vector<Double> y1Vector) voidsetY2Vector(Vector<Double> y2Vector) voidsetYGridUserPositions(int[] yGridUserPositions) voidsetYInvert(int yInvert) voidCalls paint.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, getNextFocusableComponent, getPopupLocation, 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, 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, updateUIMethods 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, validateTreeMethods 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, 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
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDUse serialVersionUID for interoperability.- See Also:
-
MAX_NUM_FUNCTS
public static final int MAX_NUM_FUNCTSMaximum number of functions that the graph may display.- See Also:
-
copiedXs
private static float[] copiedXsDOCUMENT ME! -
copiedYs
private static float[] copiedYsDOCUMENT ME! -
copiedName
DOCUMENT ME! -
copiedFunct
DOCUMENT ME! -
backgroundColor
DOCUMENT ME! -
bounds
DOCUMENT ME! -
crosshairCursor
DOCUMENT ME! -
defaultCursor
DOCUMENT ME! -
defaultMaxDomain
private float defaultMaxDomainDOCUMENT ME! -
defaultMaxRange
private float defaultMaxRangeDOCUMENT ME! -
defaultMinDomain
private float defaultMinDomainDOCUMENT ME! -
defaultMinRange
private float defaultMinRangeDOCUMENT ME! -
fittedFunctions
DOCUMENT ME! -
font10
DOCUMENT ME! -
font12
DOCUMENT ME! -
font12B
DOCUMENT ME! -
fun2Icon
DOCUMENT ME! -
fun2PrintIcon
DOCUMENT ME! -
fun3Icon
DOCUMENT ME! -
fun3PrintIcon
DOCUMENT ME! -
fun4Icon
DOCUMENT ME! -
fun4PrintIcon
DOCUMENT ME! -
fun5Icon
DOCUMENT ME! -
fun5PrintIcon
DOCUMENT ME! -
functions
DOCUMENT ME! -
graphBounds
DOCUMENT ME! -
maxDomain
private float maxDomainDOCUMENT ME! -
maxRange
private float maxRangeDOCUMENT ME! -
minDomain
private float minDomainDOCUMENT ME! -
minRange
private float minRangeDOCUMENT ME! -
newX
private int[] newXDOCUMENT ME! -
newY
private int[] newYDOCUMENT ME! -
oldRubberband
DOCUMENT ME! -
parentFrame
DOCUMENT ME! -
rubberbandRect
DOCUMENT ME! -
showFittedFunctions
private boolean showFittedFunctionsDOCUMENT ME! -
showFunctions
private boolean showFunctionsDOCUMENT ME! -
showGridLines
private boolean showGridLinesDOCUMENT ME! -
showLegend
private boolean showLegendDOCUMENT ME! -
showMinorTickMarks
private boolean showMinorTickMarksDOCUMENT ME! -
SHOW_LINES_ONLY
public static final int SHOW_LINES_ONLY- See Also:
-
SHOW_POINTS_AND_LINES
public static final int SHOW_POINTS_AND_LINES- See Also:
-
SHOW_POINTS_ONLY
public static final int SHOW_POINTS_ONLY- See Also:
-
showPointsAndLines
private int showPointsAndLinesDOCUMENT ME! -
title
DOCUMENT ME! -
xGridLines
private int xGridLinesDOCUMENT ME! -
xLabel
DOCUMENT ME! -
xScale
private double xScaleDOCUMENT ME! -
xTick
private double xTickDOCUMENT ME! -
yGridLines
private int yGridLinesDOCUMENT ME! -
yLabel
DOCUMENT ME! -
yScale
private double yScaleDOCUMENT ME! -
yTick
private double yTickDOCUMENT ME! -
userXGrid
private boolean userXGrid -
userYGrid
private boolean userYGrid -
xGridUserPositions
private int[] xGridUserPositions -
yGridUserPositions
private int[] yGridUserPositions -
doLogX
private boolean doLogX -
doLogY
private boolean doLogY -
zeroXMin
private boolean zeroXMin -
zeroYMin
private boolean zeroYMin -
x1Vector
-
y1Vector
-
x2Vector
-
y2Vector
-
addSchwarzChristoffelLines
private boolean addSchwarzChristoffelLines -
yInvert
private int yInvert
-
-
Constructor Details
-
ViewJComponentGraph
Constructor - creates graph within the JPanel using graphics.- Parameters:
frame- frame that this component is inwidth- initial width for the componentheight- initial height for the component
-
-
Method Details
-
calculateCustomDomain
public void calculateCustomDomain() -
calculateCustomRange
public void calculateCustomRange()Calculates the range and domain (according to min and max y values). and expands range if necessary. (does not shrink range) -
calculateDefaultRangeDomain
public void calculateDefaultRangeDomain()Calculates the default range and domain (according to min and max x and y values). Modifies minRange, maxRange, minDomain, maxDomain accordingly. -
copyFunct
public void copyFunct(int index) Copies the indicated function's properties, to be pasted later as a new function.- Parameters:
index- - index of the function to be copied
-
deleteFunct
public void deleteFunct(int index) Deletes the indicated function.- Parameters:
index- - index of the function to be deleted
-
getBackgroundColor
Accessor that gets the background color.- Returns:
- DOCUMENT ME!
-
getBounds
Accessor that returns the bounds of the component. -
getMaxDomain
public float getMaxDomain() -
getMinDomain
public float getMinDomain() -
getDefaultMaxDomain
public float getDefaultMaxDomain()Returns the default maximum point for the domain (previously calculated).- Returns:
- DOCUMENT ME!
-
getDefaultMinDomain
public float getDefaultMinDomain()Returns the default minimum point for the domain (previously calculated).- Returns:
- DOCUMENT ME!
-
getDefaultMaxRange
public float getDefaultMaxRange()Returns the default maximum point for the range (previously calculated).- Returns:
- DOCUMENT ME!
-
getDefaultMinRange
public float getDefaultMinRange()Returns the default minimum point for the range (previously calculated).- Returns:
- DOCUMENT ME!
-
getFittedFunctionsVisible
public boolean getFittedFunctionsVisible()Accessor that gets the visible flag.- Returns:
- the boolean visible flag
-
getFittedFuncts
Accessor that gets the fitted functions for this graph.- Returns:
- an array of functions for this graph
-
getFunctionsVisible
public boolean getFunctionsVisible()Accessor that gets the visible flag of the functions.- Returns:
- the boolean visible flag
-
getFuncts
Accessor that gets the functions for this graph.- Returns:
- an array of functions for this graph
-
getGridlinesVisible
public boolean getGridlinesVisible()Accessor that gets the visible flag.- Returns:
- the boolean visible flag
-
getLegendVisible
public boolean getLegendVisible()Accessor that gets the visible flag.- Returns:
- the boolean visible flag
-
getMaxRange
public float getMaxRange()Returns the current maximum point for the range.- Returns:
- DOCUMENT ME!
-
getMinimumSize
Accessor that returns the minimum size of this component.- Overrides:
getMinimumSizein classJComponent- Returns:
- the minimum size
-
getMinorTickMarksVisible
public boolean getMinorTickMarksVisible()Accessor that gets the visible flag.- Returns:
- the boolean visible flag
-
getMinRange
public float getMinRange()Returns the current minimum point for the range.- Returns:
- DOCUMENT ME!
-
getNumberOfXGridLines
public int getNumberOfXGridLines()Accessor that gets the number of gridlines for paint.- Returns:
- the number of gridlines on the x axis
-
getNumberOfYGridLines
public int getNumberOfYGridLines()Accessor that gets the number of gridlines for paint.- Returns:
- the number of gridlines on the y axis
-
getPointsAndLinesDisplay
public int getPointsAndLinesDisplay()Accessor that gets the visible flag.- Returns:
- the integer visible flag
-
getPreferredSize
Accessor that returns the preferred size of the component.- Overrides:
getPreferredSizein classJComponent- Returns:
- the preferred size
-
getTitle
Gets the title for the graph.- Returns:
- title for the graph
-
getXLabel
Gets the label for the x axis.- Returns:
- label for the x axis
-
getYLabel
Gets the label for the y axis.- Returns:
- label for the y axis
-
mouseClicked
DOCUMENT ME!- Specified by:
mouseClickedin interfaceMouseListener- Parameters:
mouseEvent- DOCUMENT ME!
-
mouseDragged
******************* Mouse Motion Events ***************************.********************************************* ***********************- Specified by:
mouseDraggedin interfaceMouseMotionListener- Parameters:
mouseEvent- DOCUMENT ME!
-
mouseEntered
************************ Mouse Events *****************************.********************************************* ***********************- Specified by:
mouseEnteredin interfaceMouseListener- Parameters:
mouseEvent- DOCUMENT ME!
-
mouseExited
DOCUMENT ME!- Specified by:
mouseExitedin interfaceMouseListener- Parameters:
mouseEvent- DOCUMENT ME!
-
mouseMoved
Changes the cursor to crosshair and enables the zoom box rubberband if the cursor is in the graph; also sees if cursor is near a valid point and prints it out.- Specified by:
mouseMovedin interfaceMouseMotionListener- Parameters:
mouseEvent- event that triggered this function
-
mousePressed
DOCUMENT ME!- Specified by:
mousePressedin interfaceMouseListener- Parameters:
mouseEvent- DOCUMENT ME!
-
mouseReleased
Checks to see that the zoom box is valid, then redraws the graph using the zoom box as bounds.- Specified by:
mouseReleasedin interfaceMouseListener- Parameters:
mouseEvent- event that triggered this function
-
paintComponent
Paints the graph. Checks if the labels are defined and draws them, checks if the gridlines should be shown and draws them, then calls PolyLine with the points.- Overrides:
paintComponentin classJComponent- Parameters:
g- Graphics to paint in
-
paintComponentForPrinter
Paints the graph for the Printer. Certain things such as background color and graph dimensions and location differ from the regular paint method- Parameters:
g- Graphics to paint in
-
pasteFunct
public void pasteFunct()Adds the previously copied copied function to the graph. -
redrawGraph
Redraws the graph based on the new bounds. Used for zooming in on portions of the graph.- Parameters:
newBounds- the new bounds of the graph
-
resetBounds
Sets the bounds of the component.- Parameters:
rect- the new bounds for the component
-
setBackgroundColor
Accessor that sets the background color to paint.- Parameters:
color- the new background color
-
setDefaultRangeDomain
public void setDefaultRangeDomain()Sets range and domain to defaults. -
setDoLogX
public void setDoLogX(boolean doLogX) - Parameters:
doLogX-
-
setDoLogY
public void setDoLogY(boolean doLogY) - Parameters:
doLogY-
-
setDomain
public void setDomain(float min, float max) Sets the domain of the graph according to the min and max parmaters.- Parameters:
min- minimum domainmax- maximum domain
-
setFittedFunctionsVisible
public void setFittedFunctionsVisible(boolean visible) Accessor that tells whether to show the gridlines.- Parameters:
visible- boolean to set it to
-
setFittedFuncts
Accessor that sets the fitted functions for this graph.- Parameters:
functs- function to set the graph to
-
setFunctionsVisible
public void setFunctionsVisible(boolean visible) Accessor that tells whether to show the functions.- Parameters:
visible- boolean to set it to
-
setFuncts
Accessor that sets the function for this graph.- Parameters:
functs- function to set the graph to
-
setGridlinesVisible
public void setGridlinesVisible(boolean visible) Accessor that tells whether to show the gridlines.- Parameters:
visible- boolean to set it to
-
setLabels
Sets the labels for the x and y axis to these strings.- Parameters:
xStr- label for the x axisyStr- label for the y axis
-
setLabelY
Sets the y axis label to yStr- Parameters:
yStr-
-
setLegendVisible
public void setLegendVisible(boolean visible) Accessor that tells whether to show the legend.- Parameters:
visible- boolean to set it to
-
setMinorTickMarksVisible
public void setMinorTickMarksVisible(boolean visible) Accessor that tells whether to show the minor tick marks.- Parameters:
visible- boolean to set it to
-
setNumberOfXGridLines
public void setNumberOfXGridLines(int xGrid) Accessor that sets the number of gridlines for paint.- Parameters:
xGrid- the number of gridlines on the x axis
-
setNumberOfYGridLines
public void setNumberOfYGridLines(int yGrid) Accessor that sets the number of gridlines for paint.- Parameters:
yGrid- the number of gridlines on the y axis
-
setPointsAndLinesDisplay
public void setPointsAndLinesDisplay(int showPointsAndLines) Accessor that sets whether to display lines only, points and lines, or points only- Parameters:
visible- integer to set it to
-
setRange
public void setRange(float min, float max) Sets the range of the graph according to the min and max parmaters.- Parameters:
min- minimum rangemax- maximum range
-
setRangeSymmetric
public void setRangeSymmetric()DOCUMENT ME! -
setTitle
Sets the title to this string.- Parameters:
tStr- title for the graph
-
update
Calls paint.- Overrides:
updatein classJComponent- Parameters:
g- Graphics to paint in
-
distance
private double distance(int x1, int y1, int x2, int y2) Tests the distance between two points.- Parameters:
x1- x coordinate of the first pointy1- y coordinate of the first pointx2- x coordinate of second pointy2- y coordinate of second point- Returns:
- returns the distance
-
makeString
Makes a string of a float with a specific number of decimal points.- Parameters:
number- number to be converted to a stringdecPts- the number of decimal points- Returns:
- string representation of the number
-
plotGraph
Plots the graph by calling PolyLine. Makes new arrays for the x and y, scaling them to the graphics x and y. Also writes the tick mark labels.- Parameters:
g- graphics to draw in
-
plotSchwarzChristoffel
-
plotGraphForPrinter
Same as the plotGraph method, except the points used in this method are readable when sent to the printer.- Parameters:
g- graphics to draw in
-
getGraphBounds
-
drawString
-
drawLine
-
setUserXGrid
public void setUserXGrid(boolean userXGrid) -
setXGridUserPositions
public void setXGridUserPositions(int[] xGridUserPositions) -
setUserYGrid
public void setUserYGrid(boolean userYGrid) -
setYGridUserPositions
public void setYGridUserPositions(int[] yGridUserPositions) -
setX1Vector
-
getX1Vector
-
setX2Vector
-
getX2Vector
-
setY1Vector
-
getY1Vector
-
setY2Vector
-
getY2Vector
-
setAddSchwarzChristoffelLines
public void setAddSchwarzChristoffelLines(boolean addSchwarzChristoffelLines) -
setYInvert
public void setYInvert(int yInvert)
-