|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent org.strbio.util.graph.Graph2D
public class Graph2D
A component that displays a 2D graph, similar to gnuplot. The graph contains an area in the middle containing zero or more Graphable2D objects, optional title text, optional labels, and optional axis labels.
Version 1.0, 4/20/99 - original version.
Nested Class Summary | |
---|---|
static interface |
Graph2D.ClickListener
This is an interface for things that are interested in knowing when the graph is clicked. |
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.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
int |
BOX_ALL
Draw box completely around graph region (default). |
int |
BOX_BOTTOM
Draw line on bottom side of graph region. |
int |
BOX_LEFT
Draw line on left side of graph region. |
int |
BOX_NONE
Don't draw a box around the graph region. |
int |
BOX_RIGHT
Draw line on right side of graph region. |
int |
BOX_TOP
Draw line on top side of graph region. |
static int |
FLIP_X
Flip the plot left-right (i.e. 0 on the right, going left) |
static int |
FLIP_Y
Flip the plot up-down (i.e. 0 on the bottom, going up) |
protected boolean |
flipX
|
protected boolean |
flipY
|
protected double |
maxX
|
protected double |
maxY
|
protected double |
minX
|
protected double |
minY
|
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, 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 |
---|
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 | |
---|---|
Graph2D()
Start with nothing. |
Method Summary | |
---|---|
void |
addGraph(Graphable2D gr)
Add a graph to the view, setting its legend font to the current one. |
protected double |
calcMaxX()
Returns the maximum x value, from all the graphs. |
protected double |
calcMaxY()
Returns the maximum y value, from all the graphs. |
protected double |
calcMinX()
Returns the minimum x value, from all the graphs. |
protected double |
calcMinY()
Returns the minimum y value, from all the graphs. |
double |
getMaxX()
Returns the maximum x value currently being plotted. |
double |
getMaxY()
Returns the maximum y value currently being plotted. |
java.awt.Dimension |
getMinimumSize()
|
double |
getMinX()
Returns the minimum x value currently being plotted. |
double |
getMinY()
Returns the minimum y value currently being plotted. |
java.awt.Dimension |
getPreferredSize()
|
XAxisScale |
getXAxisScale()
gets the x axis scale |
YAxisScale |
getYAxisScale()
gets y axis scale |
void |
makeXAxisScale()
make new x axis scale. |
void |
makeYAxisScale()
make new y axis scale. |
void |
paintComponent(java.awt.Graphics g)
display on screen. |
void |
paintGraph(java.awt.Graphics g,
int width,
int height)
Displays everything on a given sized area (printer page, or screen). |
void |
print(java.awt.Frame fr)
Print the graph to a printer. |
void |
removeGraph(Graphable2D gr)
Remove a graph. |
void |
reRender()
Repaint everything. |
void |
rescale()
Rescale, if autoscaling. |
void |
setBox(int boxStyle)
Sets box drawing style. |
void |
setFont(java.awt.Font f)
Sets the font for all labels / titles. |
void |
setFormat(java.lang.String x)
Sets the format string for printing axis scales. |
void |
setGraphSize(int x,
int y)
Set the preferred size of the graph window. |
void |
setListener(Graph2D.ClickListener l)
Sets the object that listens for clicks on the graph. |
void |
setMaxX(double x)
Set the maximum x value to plot... turns off autoscaling of the maximum. |
void |
setMaxY(double y)
Set the maximum y value to plot... turns off autoscaling of the maximum. |
void |
setMinX(double x)
Set the minimum X value to plot... turns off autoscaling. |
void |
setMinY(double y)
Set the minimum Y value to plot... turns off autoscaling. |
void |
setOrientation(int orientation)
Set the preferred orientation. |
void |
setTitle(java.lang.String x)
Sets title. |
void |
setXAxisLabel(java.lang.String x)
Sets x axis label |
void |
setYAxisLabel(java.lang.String x)
Sets y axis label |
void |
transform(double x,
double y,
java.awt.Point p)
Transforms a given value (x,y) in real coordinates into a point to be plotted on the screen, considering min, max, etc. |
Methods inherited from class javax.swing.JComponent |
---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, 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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, 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, 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, transferFocusBackward, 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, 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, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, 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 |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected double minX
protected double minY
protected double maxX
protected double maxY
public final int BOX_NONE
public final int BOX_LEFT
public final int BOX_RIGHT
public final int BOX_TOP
public final int BOX_BOTTOM
public final int BOX_ALL
public static final int FLIP_X
public static final int FLIP_Y
protected boolean flipY
protected boolean flipX
Constructor Detail |
---|
public Graph2D()
Method Detail |
---|
public void setListener(Graph2D.ClickListener l)
public final void setBox(int boxStyle)
public void setTitle(java.lang.String x)
public void setXAxisLabel(java.lang.String x)
public void setYAxisLabel(java.lang.String x)
public XAxisScale getXAxisScale()
public void makeXAxisScale()
public void makeYAxisScale()
public YAxisScale getYAxisScale()
protected double calcMaxX()
protected double calcMinX()
protected double calcMaxY()
protected double calcMinY()
public double getMinX()
public double getMaxX()
public double getMinY()
public double getMaxY()
public void setMinX(double x)
public void setMaxX(double x)
public void setMinY(double y)
public void setMaxY(double y)
public void rescale()
public void addGraph(Graphable2D gr)
public void removeGraph(Graphable2D gr)
public java.awt.Dimension getMinimumSize()
getMinimumSize
in class javax.swing.JComponent
public java.awt.Dimension getPreferredSize()
getPreferredSize
in class javax.swing.JComponent
public void setGraphSize(int x, int y)
public void setOrientation(int orientation)
public void setFormat(java.lang.String x)
public void setFont(java.awt.Font f)
setFont
in class javax.swing.JComponent
public void transform(double x, double y, java.awt.Point p)
public void paintComponent(java.awt.Graphics g)
paintComponent
in class javax.swing.JComponent
public void paintGraph(java.awt.Graphics g, int width, int height)
public void reRender()
public void print(java.awt.Frame fr)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |