jhplot.gui
Class WPlotFrame
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- java.awt.Window
-
- java.awt.Frame
-
- javax.swing.JFrame
-
- jhplot.gui.WPlotFrame
-
- All Implemented Interfaces:
- java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.ChangeListener, javax.swing.RootPaneContainer, javax.swing.WindowConstants, GCFrameInterface
public class WPlotFrame extends javax.swing.JFrame implements GCFrameInterface, javax.swing.event.ChangeListener
A frame provides a JFrame subclass that supports graphs and grids of graphs. Management of multipleWPlotFrame
s in a JVM instance is coordinated via an instance of theFrameManager
class. Typically, the graphics container for a GCFrame is either:- a
GCGridContainer
- for single grids - a
GCTabbedGridContainer
- for multiply tabbed grids
GCGridContainer
is used. Its contents will be automatically added to Tab 0 of aGCTabbedGridContainer
when required and theGCTabbedGridContainer
will become the content pane. However, the content pane can be another component parenting the graphics container e.g. a JPanel with a border layout and the graphics container in its center in custom implementations. Use setGraphicsContainer() to direct a GCFrame to the appropriate component. For convenience, this class includes add and makeTabbed methods that forward calls to the content pane. For other methods, the content pane needs to be accessed explicitly.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
-
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
-
Constructor Summary
Constructors Constructor and Description WPlotFrame()
Default constructor to make WPlot canvas.WPlotFrame(java.lang.String titleText)
Creates aGCFrame
with a single graph (i.e.WPlotFrame(java.lang.String titleText, int xsize, int ysize, boolean isshown)
Creates aGCFrame
with a single graph (i.e.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description void
actionPerformed(java.awt.event.ActionEvent ae)
java.awt.Component
add(java.awt.Component c)
Adds the specified Component to the graphics container at grid location 0,0 in tab 0.java.awt.Component
add(java.awt.Component c, double row, double column, double width, double height, int tab)
Adds a component to the grid at the specified row and column position in the specified tab.java.awt.Component
add(java.awt.Component c, double row, double column, int tab)
Adds a component to the grid at the specified row and column position in the specified tab.java.awt.Component
addTab(java.lang.String s, java.awt.Component c)
Adds a tab using the supplied Component.void
export(java.lang.String f)
Fast export of the canvas to an image file (depends on the extension, i.e.GCGridContainerInterface
getGraphicsContainer()
Returns the graphics container for this instance.void
makeTabbed(java.lang.String title)
/** Adds a tab with no title to the content pane.void
setGraphicsContainer(GCGridContainerInterface c)
Sets the supplied graphics container as the content pane for the frame.void
stateChanged(javax.swing.event.ChangeEvent ce)
-
Methods inherited from class javax.swing.JFrame
getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setTransferHandler, update
-
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
-
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
-
Methods inherited from class java.awt.Container
add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface kcl.waterloo.swing.GCFrameInterface
dispose, getJMenuBar, getTitle
-
-
-
-
Constructor Detail
-
WPlotFrame
public WPlotFrame()
Default constructor to make WPlot canvas. It creates aGCFrame
with a single graph (i.e. a 1x1 grid) in a GCGridContainer.
-
WPlotFrame
public WPlotFrame(java.lang.String titleText)
Creates aGCFrame
with a single graph (i.e. a 1x1 grid)- Parameters:
titleText
- the Title for the frame.
-
WPlotFrame
public WPlotFrame(java.lang.String titleText, int xsize, int ysize, boolean isshown)
Creates aGCFrame
with a single graph (i.e. a 1x1 grid)- Parameters:
titleText
- the Title for the frame.
-
-
Method Detail
-
getGraphicsContainer
public GCGridContainerInterface getGraphicsContainer()
Returns the graphics container for this instance. While all standard implementations use the content pane of the frame as the graphics container, this need not be the case with user written replacements.- Returns:
- the GCGridContainerInterface
-
setGraphicsContainer
public final void setGraphicsContainer(GCGridContainerInterface c)
Sets the supplied graphics container as the content pane for the frame.- Parameters:
c
- a GCGridContainerInterface
-
add
public java.awt.Component add(java.awt.Component c)
Adds the specified Component to the graphics container at grid location 0,0 in tab 0.- Overrides:
add
in classjava.awt.Container
- Parameters:
c
- the Component to add- Returns:
- the added Component
-
add
public final java.awt.Component add(java.awt.Component c, double row, double column, int tab) throws java.lang.UnsupportedOperationException
Adds a component to the grid at the specified row and column position in the specified tab.- Parameters:
c
- the component to add.row
- the row position in grid elementscolumn
- the column position in grid elementstab
- the tab position- Returns:
- the added component
- Throws:
java.lang.UnsupportedOperationException
-
add
public final java.awt.Component add(java.awt.Component c, double row, double column, double width, double height, int tab) throws java.lang.UnsupportedOperationException
Adds a component to the grid at the specified row and column position in the specified tab. The width and height of the component are also specified.- Parameters:
c
- the component to add.row
- the row position in grid elementscolumn
- the column position in grid elementswidth
- the width of the component in grid elementsheight
- the height of the component in grid elementstab
- the tab position- Returns:
- the added component
- Throws:
java.lang.UnsupportedOperationException
-
makeTabbed
public void makeTabbed(java.lang.String title)
/** Adds a tab with no title to the content pane. If required, a GCTabbedGridContainer will be created and set as the content pane. The previous contents will be copied to tab 0.- Parameters:
title
- for the tab
-
addTab
public java.awt.Component addTab(java.lang.String s, java.awt.Component c) throws java.lang.UnsupportedOperationException
Adds a tab using the supplied Component.- Parameters:
s
- the name for the tabc
- the Component to form the tab- Returns:
- the Component c
- Throws:
java.lang.UnsupportedOperationException
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent ae)
- Specified by:
actionPerformed
in interfacejava.awt.event.ActionListener
-
stateChanged
public void stateChanged(javax.swing.event.ChangeEvent ce)
- Specified by:
stateChanged
in interfacejavax.swing.event.ChangeListener
-
export
public void export(java.lang.String f)
Fast export of the canvas to an image file (depends on the extension, i.e. PNG, PDF, EPS, PS, SVG). Images can be saved to files with extension ".gz" (compressed SVG). Also, image can be saved to PDE format. No questions will be asked, an existing file will be rewritten. If- Parameters:
f
- Output file with the proper extension. If no extension, PNG file is assumed. Other formats are PNG, PDF, EPS, PS, SVG.
-
-
DMelt 3.0 © DataMelt by jWork.ORG