edu.rice.cs.drjava.ui
Class TabbedPanel

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.rice.cs.drjava.ui.TabbedPanel
All Implemented Interfaces:
DropTargetListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible
Direct Known Subclasses:
AbortablePanel, ErrorPanel, RegionsListPanel, RegionsTreePanel

public abstract class TabbedPanel
extends JPanel
implements DropTargetListener

Extended by all panels that can dynamically be added or removed from the _tabbedPane in MainFrame. Provides a boolean indicating if the panel is being displayed, and a close button. Attaches an action to the close button which calls the _close method. This method can be overwritten in a subclass if needed.

Version:
$Id: TabbedPanel.java 4691 2008-12-02 23:33:27Z dlsmith $
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  JButton _closeButton
          button which removes this pane's tab.
protected  JPanel _closePanel
           
protected  boolean _displayed
          indicates whether this tab is displayed in the tabbed pane.
protected  MainFrame _frame
           
protected  JPanel _mainPanel
           
 
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
TabbedPanel(MainFrame frame, String name)
          Constructor.
 
Method Summary
protected  void _close()
          Visibly closes the panel and removes it from the frame.
 void addCloseListener(ActionListener l)
           
 void dragEnter(DropTargetDragEvent dropTargetDragEvent)
          User dragged something into the component.
 void dragExit(DropTargetEvent dropTargetEvent)
           
 void dragOver(DropTargetDragEvent dropTargetDragEvent)
           
 void drop(DropTargetDropEvent dropTargetDropEvent)
          User dropped something on the component.
 void dropActionChanged(DropTargetDragEvent dropTargetDragEvent)
           
 String getName()
           
 boolean isDisplayed()
           
 boolean requestFocusInWindow()
          This is overridden so that when switch previous pane focus is called on the currentDefPane, the caret will move here on the first call.
 void setDisplayed(boolean displayed)
          Sets whether the tab is displayed.
 void setVisible(boolean b)
           
 
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, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, 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, setUI, setVerifyInputWhenFocusTarget, 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, 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

_displayed

protected boolean _displayed
indicates whether this tab is displayed in the tabbed pane.


_closeButton

protected JButton _closeButton
button which removes this pane's tab.


_closePanel

protected JPanel _closePanel

_mainPanel

protected JPanel _mainPanel

_frame

protected MainFrame _frame
Constructor Detail

TabbedPanel

public TabbedPanel(MainFrame frame,
                   String name)
Constructor.

Parameters:
frame - MainFrame displaying the tab
name - Name to display for the tab
Method Detail

_close

protected void _close()
Visibly closes the panel and removes it from the frame.


addCloseListener

public void addCloseListener(ActionListener l)

setVisible

public void setVisible(boolean b)
Overrides:
setVisible in class JComponent

isDisplayed

public boolean isDisplayed()
Returns:
whether this tabbedPanel is displayed in a tab

getName

public String getName()
Overrides:
getName in class Component
Returns:
the display name of this tab.

setDisplayed

public void setDisplayed(boolean displayed)
Sets whether the tab is displayed. Doesn't actually show or hide the tab.


requestFocusInWindow

public boolean requestFocusInWindow()
This is overridden so that when switch previous pane focus is called on the currentDefPane, the caret will move here on the first call.

Overrides:
requestFocusInWindow in class JComponent

dragEnter

public void dragEnter(DropTargetDragEvent dropTargetDragEvent)
User dragged something into the component.

Specified by:
dragEnter in interface DropTargetListener

dragExit

public void dragExit(DropTargetEvent dropTargetEvent)
Specified by:
dragExit in interface DropTargetListener

dragOver

public void dragOver(DropTargetDragEvent dropTargetDragEvent)
Specified by:
dragOver in interface DropTargetListener

dropActionChanged

public void dropActionChanged(DropTargetDragEvent dropTargetDragEvent)
Specified by:
dropActionChanged in interface DropTargetListener

drop

public void drop(DropTargetDropEvent dropTargetDropEvent)
User dropped something on the component.

Specified by:
drop in interface DropTargetListener