|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
ifi.dsb.Plot2D
Class for creating 2-dimensional plots, typically x-y plots. A Plot2D object is composed of two axis objects, one graph object (including the curves/markers) and an optional menu.
The SignalGraph class is an alternative, providing a higher-level class for plotting signals and spectra.
Typical use of Plot2D:
double[] xData, yData, xData2, yData2;
String xLabel;
Dimension size;
// Assume that xData and yData are given x-values and y-values
// for the first curve, and that xData2 and yData2 are given values
// for the second curve. Assume also that xLabel holds a string
// for the x axis label, and that size holds the required size
// of the plot in pixels.
// Create Plot2D object with one curve.
Plot2D plot = new Plot2D(xData, yData, size);
// Create additional curve object.
Curve curve = new Curve(plot, xData2, yData2);
// Set axis label text
plot.getXAxis().getAxisLabel().setLabel(xLabel);
// Add second curve to plot.
plot.addCurve(curve);
// Create window
JFrame frame = new JFrame("some-title");
// Add plot to window
Container contentPane = frame.getContentPane();
contentPane.add(plot);
// Add plot menu
frame.setJMenuBar(plot.getMenuBar());
// Place window on screen
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
SignalGraph,
Axis,
Graph,
Curve,
CurveData,
Serialized Form| Nested Class Summary |
| Nested classes inherited from class javax.swing.JPanel |
javax.swing.JPanel.AccessibleJPanel |
| Nested classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
| Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
| Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary |
| 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 | |
Plot2D(Axis xAxis,
Axis yAxis,
java.awt.Dimension size)
Constructs a new Plot2D object. |
|
Plot2D(Axis xAxis,
Axis yAxis,
Graph graph,
java.awt.Dimension size)
Constructs a new Plot2D object. |
|
Plot2D(double[] data)
Constructs a new Plot2D object of default size, with horizontal-coordinate curve values from zero to the length of the data vector. |
|
Plot2D(double[] data,
java.awt.Dimension size)
Constructs a new Plot2D object, with horizontal-coordinate curve values from zero to the length of the data vector. |
|
Plot2D(double[] xData,
double[] yData)
Constructs a new Plot2D object of default size. |
|
Plot2D(double[] xData,
double[] yData,
java.awt.Dimension size)
Constructs a new Plot2D object. |
|
| Method Summary | |
void |
addCurve(Curve curve)
Add a Curve object, if the plot already has a Graph object. |
javax.swing.JMenu |
getFileMenu()
Return reference to File menu. |
Graph |
getGraph()
Return the graph object. |
javax.swing.JMenuBar |
getMenuBar()
Return reference to menubar which includes the File and Options menus. |
javax.swing.JMenu |
getOptionsMenu()
Return reference to Options menu. |
java.awt.Dimension |
getPreferredSize()
Return preferred size of the plot. |
Axis |
getXAxis()
Return the horizontal axis object. |
Axis |
getYAxis()
Return the vertical axis object. |
| Methods inherited from class javax.swing.JPanel |
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
| Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getWidth, getVisibleRect, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
| Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, 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 |
| Constructor Detail |
public Plot2D(double[] data)
data - Curve coordinate values along the vertical xaxis. The array
is copied to an internal storage buffer.
public Plot2D(double[] data,
java.awt.Dimension size)
data - Curve coordinate values along the vertical xaxis. The array
is copied to an internal storage buffer.size - Size of plot in pixels.
public Plot2D(double[] xData,
double[] yData)
xData - Curve coordinate values along the horizontal xaxis.
The array is copied to an internal storage buffer.yData - Curve coordinate values along the vertical axis.
The array is copied to an internal storage buffer.
public Plot2D(double[] xData,
double[] yData,
java.awt.Dimension size)
xData - Curve coordinate values along the horizontal xaxis.
The array is copied to an internal storage buffer. If null and
yData is not null, the horizontal curve-coordinates will consist
of integers from zero to yData.length.yData - Curve coordinate values along the vertical axis.
The array is copied to an internal storage buffer.size - Size of plot in pixels.
public Plot2D(Axis xAxis,
Axis yAxis,
java.awt.Dimension size)
xAxis - Axis object to be used for the horizontal axis.yAxis - Axis object to be used for the vertical axis.size - Size of plot in pixels.
public Plot2D(Axis xAxis,
Axis yAxis,
Graph graph,
java.awt.Dimension size)
xAxis - Axis object to be used for the horizontal axis.yAxis - Axis object to be used for the vertical axis.graph - Graph object.size - Size of plot in pixels.| Method Detail |
public java.awt.Dimension getPreferredSize()
public javax.swing.JMenu getFileMenu()
public javax.swing.JMenu getOptionsMenu()
public javax.swing.JMenuBar getMenuBar()
public Axis getXAxis()
public Axis getYAxis()
public Graph getGraph()
public void addCurve(Curve curve)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||