|
||||||||||
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.JLayeredPane
javax.swing.JDesktopPane
edu.princeton.cs.algs4.growingtree.framework.TreeJDesktop
public class TreeJDesktop
The JDesktop class intended for a tree structure. Within this class, the panels for the trees are constructed as are the JPanel panes to hold them and the internal frames and tabbed pane.
The desktop listens for OptionEvents specific to a chosen tree, and calls that required command for the selected panel (whether it is tabbed pane or a selected window). Also, the desktop listens for events affecting all trees. The only events that bypass the desktop are those based upon clicking upon the tree.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.BaselineResizeBehavior |
Field Summary |
---|
Fields inherited from class javax.swing.JDesktopPane |
---|
LIVE_DRAG_MODE, OUTLINE_DRAG_MODE |
Fields inherited from class javax.swing.JLayeredPane |
---|
DEFAULT_LAYER, DRAG_LAYER, FRAME_CONTENT_LAYER, LAYER_PROPERTY, MODAL_LAYER, PALETTE_LAYER, POPUP_LAYER |
Fields inherited from class javax.swing.JComponent |
---|
TOOL_TIP_TEXT_KEY, 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 | |
---|---|
TreeJDesktop()
Sole Constructor, which constructs all of the tree panels and sets up all of the listening. |
Method Summary | ||
---|---|---|
void |
addMouseListener(java.awt.event.MouseListener l)
Adds the specified mouse listener to receive mouse events from this component. |
|
void |
addMouseMotionListener(java.awt.event.MouseMotionListener l)
Adds the specified mouse motion listener to receive mouse motion events from this component. |
|
void |
addOptionListener(OptionListener l)
Adds an OptionEventListener according to the OptionEventListener interface and the OptionEvent . |
|
|
addTree(java.lang.String name,
P p,
IInsertOperator<P> inserter,
ISearchOperator<P> searcher,
IDeleteOperator<P> deleter)
|
|
|
addTree(java.lang.String name,
P p,
IInsertOperator<P> inserter,
ISearchOperator<P> searcher,
IDeleteOperator<P> deleter,
boolean allowRotations)
|
|
|
addTree(java.lang.String name,
P p,
IInsertOperator<P> inserter,
ISearchOperator<P> searcher,
IDeleteOperator<P> deleter,
IExperimentLogger<P> logger)
|
|
|
addTree(java.lang.String name,
P p,
IInsertOperator<P> inserter,
ISearchOperator<P> searcher,
IDeleteOperator<P> deleter,
IExperimentLogger<P> logger,
boolean allowRotations)
|
|
void |
addTreeMessageListener(TreeMessageListener l)
Adds an TreeMessageListener from the TREE, according to the TreeMessageListener interface and the TreeMessageEvent . |
|
javax.swing.Icon |
getIcon(java.lang.String imageName)
Gets the icon from the resource (JAR file). |
|
javax.swing.JPanel |
getSelectedPanel()
Gets the currently selected panel, whether it is the panel selected of the windows or whether it is the selected tabbed pane. |
|
void |
init()
|
|
void |
initialize()
Original intialization. |
|
boolean |
isWindows()
Gets if the desktop is set up in windows format or tabbed pabe format. |
|
void |
makeRandomTree(java.lang.String startKey,
java.lang.String endKey,
int size,
boolean duplicates)
Constructs a random Tree for every tree currently in the desktop. |
|
void |
makeTabbedPane()
Makes a tabbedPane. |
|
void |
makeWindows()
Makes the windows for the Desktop. |
|
void |
optionEventPerformed(OptionEvent e)
Option event listener. |
|
void |
removeMouseListener(java.awt.event.MouseListener l)
Removes the specified mouse listener so that it no longer receives mouse events from this component. |
|
void |
removeMouseMotionListener(java.awt.event.MouseMotionListener l)
Removes the specified mouse motion listener so that it no longer receives mouse motion events from this component. |
|
void |
removeOptionListener(TreeMessageListener l)
Removes an OptionEventListener according to the OptionEventListener interface and the OptionEvent . |
|
void |
removeTreeMessageListener(TreeMessageListener l)
Removes an TreeMessageListener from the TREE, according to the TreeMessageListener interface and the TreeMessageEvent . |
|
void |
setSelectedFrame(javax.swing.JInternalFrame f)
Overides the desktop method, to add functionality, by passing information about the changed frame by tree message. |
|
void |
stateChanged(javax.swing.event.ChangeEvent e)
Implements Change Listener. |
|
void |
treeMessageEventPerformed(TreeMessageEvent e)
Listens to tree message events. |
Methods inherited from class javax.swing.JDesktopPane |
---|
getAccessibleContext, getAllFrames, getAllFramesInLayer, getDesktopManager, getDragMode, getSelectedFrame, getUI, getUIClassID, remove, removeAll, selectFrame, setComponentZOrder, setDesktopManager, setDragMode, setUI, updateUI |
Methods inherited from class javax.swing.JLayeredPane |
---|
getComponentCountInLayer, getComponentsInLayer, getIndexOf, getLayer, getLayer, getLayeredPaneAbove, getPosition, highestLayer, isOptimizedDrawingEnabled, lowestLayer, moveToBack, moveToFront, paint, putLayer, setLayer, setLayer, setPosition |
Methods inherited from class javax.swing.JComponent |
---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, 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, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, 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, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, 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, remove, removeContainerListener, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, 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, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, 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 |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public TreeJDesktop()
Method Detail |
---|
public void init()
public void initialize()
public <P extends NodeProperties> void addTree(java.lang.String name, P p, IInsertOperator<P> inserter, ISearchOperator<P> searcher, IDeleteOperator<P> deleter, boolean allowRotations)
public <P extends NodeProperties> void addTree(java.lang.String name, P p, IInsertOperator<P> inserter, ISearchOperator<P> searcher, IDeleteOperator<P> deleter)
public <P extends NodeProperties> void addTree(java.lang.String name, P p, IInsertOperator<P> inserter, ISearchOperator<P> searcher, IDeleteOperator<P> deleter, IExperimentLogger<P> logger, boolean allowRotations)
public <P extends NodeProperties> void addTree(java.lang.String name, P p, IInsertOperator<P> inserter, ISearchOperator<P> searcher, IDeleteOperator<P> deleter, IExperimentLogger<P> logger)
public void makeWindows()
public void makeTabbedPane()
public boolean isWindows()
public javax.swing.JPanel getSelectedPanel()
public void addOptionListener(OptionListener l)
OptionEvent
.
l
- the listener added recieves the OptionEvents occuring.public void removeOptionListener(TreeMessageListener l)
OptionEvent
.
l
- the listener removed from recieving the OptionEvents occuring.public void addTreeMessageListener(TreeMessageListener l)
TreeMessageEvent
.
l
- the listener added recieves the TreeMessageEvents occuring.public void removeTreeMessageListener(TreeMessageListener l)
TreeMessageEvent
.
l
- the listener removed from recieving the TreeMessageEvents occuring.public void addMouseListener(java.awt.event.MouseListener l)
addMouseListener
in class java.awt.Component
l
- the mouse listener.public void removeMouseListener(java.awt.event.MouseListener l)
removeMouseListener
in class java.awt.Component
l
- the mouse listener.public void addMouseMotionListener(java.awt.event.MouseMotionListener l)
addMouseMotionListener
in class java.awt.Component
l
- the mouse motion listener.public void removeMouseMotionListener(java.awt.event.MouseMotionListener l)
removeMouseMotionListener
in class java.awt.Component
l
- the mouse motion listener.public void treeMessageEventPerformed(TreeMessageEvent e)
treeMessageEventPerformed
in interface TreeMessageListener
e
- TreeMessageEvent that contains information about the tree.public void makeRandomTree(java.lang.String startKey, java.lang.String endKey, int size, boolean duplicates)
startKey
- the starting key for the random tree.endKey
- the ending key for the random tree.size
- the size of the random tree created.duplicates
- true if duplicates are allowed in the list.public javax.swing.Icon getIcon(java.lang.String imageName)
public void optionEventPerformed(OptionEvent e)
optionEventPerformed
in interface OptionListener
e
- OptionEvent passed with information about the event.public void stateChanged(javax.swing.event.ChangeEvent e)
stateChanged
in interface javax.swing.event.ChangeListener
e
- ChangeEvent passed when the state changes.public void setSelectedFrame(javax.swing.JInternalFrame f)
setSelectedFrame
in class javax.swing.JDesktopPane
f
- JInternalFrame that is selected.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |