edu.princeton.plot
Class Plot2D

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 edu.princeton.plot.Plot2D
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.AdjustmentListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible
Direct Known Subclasses:
SimplePlot, SolutionGraph, StageGamePayoffGraph

public abstract class Plot2D
extends javax.swing.JPanel
implements java.awt.event.ActionListener, java.awt.event.AdjustmentListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener

See Also:
Serialized Form

Nested Class Summary
 class Plot2D.GeneralWrapperPanel
           
(package private) static class Plot2D.ImageTransferable
           
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
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.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  javax.swing.JCheckBoxMenuItem aliasing
           
protected  boolean antiAlias
           
(package private) static java.awt.Font AXIS_FONT
           
(package private)  java.awt.Color BACKGROUND
           
protected static int border
           
private static int BORDER
           
(package private)  boolean clicked
           
(package private)  javax.swing.JMenuItem coordinateLabel
           
protected  int DELAY
           
(package private)  boolean doNotDraw
           
protected  boolean doNotPaintMain
           
(package private)  javax.swing.JComponent generalWrapperPanel
           
(package private) static int grid_space
           
static java.awt.Color gridLineColor
           
(package private)  int h
           
protected  double[] hashX
           
protected  double[] hashY
           
static java.lang.String IMAGES_FOLDER
           
protected  boolean isUniformAxis
           
(package private) static java.awt.Color lightGray
           
(package private) static int maxHash
           
 double maxX
           
protected  double maxX_fin
           
 double maxY
           
protected  double maxY_fin
           
(package private) static double MIN_GAP
           
(package private) static double minRange
           
 double minX
           
protected  double minX_fin
           
 double minY
           
protected  double minY_fin
           
protected  boolean paintGrid
           
protected  javax.swing.JCheckBoxMenuItem paintGridItem
           
(package private)  javax.swing.JPopupMenu popup
           
(package private) static double space
           
(package private)  java.lang.String title
           
protected  javax.swing.JPanel topPanel
           
protected  javax.swing.JCheckBoxMenuItem uniformBounds
           
(package private)  int w
           
(package private)  int x
           
(package private)  java.lang.String x_axis
           
(package private)  int x1
           
(package private)  int x2
           
(package private)  int xCross
           
(package private)  int y
           
(package private)  java.lang.String y_axis
           
(package private)  int y1
           
(package private)  int y2
           
(package private)  int yCross
           
 int zoom_get_x
           
 int zoom_get_y
           
 
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()
           
 
Method Summary
abstract  void actionPerformed(java.awt.event.ActionEvent e)
           
 boolean checkBounds(double x, double y)
           
 boolean checkBounds(double x1, double y1, double x2, double y2)
           
abstract  Plot2D clonePlot()
           
 void copyImage()
           
protected  boolean drawCircle(java.awt.Graphics g, double x, double y, int width)
           
protected  boolean drawLine(java.awt.Graphics g, double x1, double y1, double x2, double y2)
           
protected  void drawPolygon(java.awt.Graphics g, double[] x_arr, double[] y_arr)
           
protected  boolean drawSquare(java.awt.Graphics g, double x, double y, int width)
           
protected  boolean fillCircle(java.awt.Graphics g, double x, double y, int width)
           
protected  boolean fillSquare(java.awt.Graphics g, double x, double y, int width)
           
abstract  java.awt.Component getPlotKey()
           
 javax.swing.JComponent getWrapper()
           
 int getXPixel(double x)
           
 int getYPixel(double y)
           
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseDragged(java.awt.event.MouseEvent e)
           
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mouseMoved(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
 void paintComponent(java.awt.Graphics g)
           
abstract  void paintComponentMainPanel(java.awt.Graphics g)
           
 void paintGridLines(java.awt.Graphics g)
           
 void paintHashMarks(java.lang.String title, java.lang.String x_axis, java.lang.String y_axis, java.awt.Graphics g)
           
 void saveImage()
           
 void setAntiAlias(boolean antiAlias)
           
abstract  void setInitialPlotBounds()
           
 void setPaintGrid(boolean paintGrid)
           
protected  boolean setPlotBounds(double min_x, double max_X, double min_y, double max_y, boolean setTotalBounds)
           
private  void setPopUpMenu()
           
 void setTitle(java.lang.String title)
           
 void setUniformBounds(boolean isUniformAxis)
           
 void setXAxis(java.lang.String x_axis)
           
 void setYAxis(java.lang.String y_axis)
           
 void showNewWindow()
           
 void showPlotKey()
           
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
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, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, 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, update
 
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
 
Methods inherited from interface java.awt.event.AdjustmentListener
adjustmentValueChanged
 

Field Detail

hashX

protected double[] hashX

hashY

protected double[] hashY

doNotPaintMain

protected boolean doNotPaintMain

topPanel

protected javax.swing.JPanel topPanel

DELAY

protected final int DELAY
See Also:
Constant Field Values

maxHash

static int maxHash

minRange

static double minRange

MIN_GAP

static double MIN_GAP

IMAGES_FOLDER

public static final java.lang.String IMAGES_FOLDER
See Also:
Constant Field Values

BORDER

private static final int BORDER
See Also:
Constant Field Values

clicked

boolean clicked

doNotDraw

boolean doNotDraw

minX_fin

protected double minX_fin

maxX_fin

protected double maxX_fin

maxY_fin

protected double maxY_fin

minY_fin

protected double minY_fin

x1

int x1

x2

int x2

y1

int y1

y2

int y2

xCross

int xCross

yCross

int yCross

x

int x

y

int y

gridLineColor

public static java.awt.Color gridLineColor

AXIS_FONT

static final java.awt.Font AXIS_FONT

coordinateLabel

javax.swing.JMenuItem coordinateLabel

generalWrapperPanel

javax.swing.JComponent generalWrapperPanel

antiAlias

protected boolean antiAlias

aliasing

protected javax.swing.JCheckBoxMenuItem aliasing

isUniformAxis

protected boolean isUniformAxis

uniformBounds

protected javax.swing.JCheckBoxMenuItem uniformBounds

paintGrid

protected boolean paintGrid

paintGridItem

protected javax.swing.JCheckBoxMenuItem paintGridItem

w

int w

h

int h

minX

public double minX

maxX

public double maxX

minY

public double minY

maxY

public double maxY

border

protected static int border

grid_space

static int grid_space

space

static double space

lightGray

static java.awt.Color lightGray

BACKGROUND

java.awt.Color BACKGROUND

popup

javax.swing.JPopupMenu popup

zoom_get_x

public int zoom_get_x

zoom_get_y

public int zoom_get_y

title

java.lang.String title

x_axis

java.lang.String x_axis

y_axis

java.lang.String y_axis
Constructor Detail

Plot2D

public Plot2D()
Method Detail

setAntiAlias

public void setAntiAlias(boolean antiAlias)

setUniformBounds

public void setUniformBounds(boolean isUniformAxis)

setPaintGrid

public void setPaintGrid(boolean paintGrid)

checkBounds

public boolean checkBounds(double x1,
                           double y1,
                           double x2,
                           double y2)

checkBounds

public boolean checkBounds(double x,
                           double y)

drawPolygon

protected void drawPolygon(java.awt.Graphics g,
                           double[] x_arr,
                           double[] y_arr)

drawSquare

protected boolean drawSquare(java.awt.Graphics g,
                             double x,
                             double y,
                             int width)

fillSquare

protected boolean fillSquare(java.awt.Graphics g,
                             double x,
                             double y,
                             int width)

drawCircle

protected boolean drawCircle(java.awt.Graphics g,
                             double x,
                             double y,
                             int width)

fillCircle

protected boolean fillCircle(java.awt.Graphics g,
                             double x,
                             double y,
                             int width)

drawLine

protected boolean drawLine(java.awt.Graphics g,
                           double x1,
                           double y1,
                           double x2,
                           double y2)

paintComponent

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

setPlotBounds

protected boolean setPlotBounds(double min_x,
                                double max_X,
                                double min_y,
                                double max_y,
                                boolean setTotalBounds)

setInitialPlotBounds

public abstract void setInitialPlotBounds()

setPopUpMenu

private void setPopUpMenu()

showNewWindow

public void showNewWindow()

clonePlot

public abstract Plot2D clonePlot()

paintComponentMainPanel

public abstract void paintComponentMainPanel(java.awt.Graphics g)

paintGridLines

public void paintGridLines(java.awt.Graphics g)

paintHashMarks

public void paintHashMarks(java.lang.String title,
                           java.lang.String x_axis,
                           java.lang.String y_axis,
                           java.awt.Graphics g)

actionPerformed

public abstract void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

getXPixel

public int getXPixel(double x)

getYPixel

public int getYPixel(double y)

showPlotKey

public void showPlotKey()

getPlotKey

public abstract java.awt.Component getPlotKey()

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

copyImage

public void copyImage()

saveImage

public void saveImage()
               throws java.io.IOException
Throws:
java.io.IOException

getWrapper

public javax.swing.JComponent getWrapper()

setTitle

public void setTitle(java.lang.String title)

setXAxis

public void setXAxis(java.lang.String x_axis)

setYAxis

public void setYAxis(java.lang.String y_axis)