com.japisoft.framework.dockable
Class DefaultTitleBar

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--com.japisoft.framework.dockable.DefaultTitleBar
All Implemented Interfaces:
DockableFrameTitleBar, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.event.MouseListener, java.io.Serializable

public class DefaultTitleBar
extends javax.swing.JComponent
implements DockableFrameTitleBar, java.awt.event.MouseListener

This is the title bar of the inner window

Author:
(c) 2004 JAPISOFT
See Also:
Serialized Form

Field Summary
 
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
DefaultTitleBar()
           
DefaultTitleBar(java.lang.String title)
           
DefaultTitleBar(java.lang.String title, javax.swing.Icon icon)
           
 
Method Summary
 void addButton(javax.swing.JButton button)
          Add a new button for acting on the DockableFrame
 void addButton(javax.swing.JButton button, boolean undecorated)
           
 void addNotify()
           
 void addSeparator()
          Add a separator for the buttons
 void focusMode(boolean focused)
          Reset the focus for this titled bar
 javax.swing.Icon getIcon()
           
 java.awt.Dimension getPreferredSize()
           
 java.lang.String getTitle()
           
 javax.swing.JComponent getView()
           
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
 void paintComponent(java.awt.Graphics gc)
           
 void prepare()
          Prepare the title bar component to be shown once all buttons have been added
 void removeAllButtons()
          Remove all buttons
 void removeNotify()
           
 void setBackground(java.awt.Color color)
          Reset the color for the background header.
 void setForeground(java.awt.Color color)
          Reset the color for the foreground header.
 void setIcon(javax.swing.Icon icon)
          Update the icon
 void setTitle(java.lang.String title)
          Update the title
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, 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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, 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, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, 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, 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
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultTitleBar

public DefaultTitleBar()

DefaultTitleBar

public DefaultTitleBar(java.lang.String title)

DefaultTitleBar

public DefaultTitleBar(java.lang.String title,
                       javax.swing.Icon icon)
Method Detail

addNotify

public void addNotify()
Overrides:
addNotify in class javax.swing.JComponent

removeNotify

public void removeNotify()
Overrides:
removeNotify in class javax.swing.JComponent

mouseClicked

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

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

mouseReleased

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

focusMode

public void focusMode(boolean focused)
Description copied from interface: DockableFrameTitleBar
Reset the focus for this titled bar

Specified by:
focusMode in interface DockableFrameTitleBar

setTitle

public void setTitle(java.lang.String title)
Description copied from interface: DockableFrameTitleBar
Update the title

Specified by:
setTitle in interface DockableFrameTitleBar

getTitle

public java.lang.String getTitle()
Specified by:
getTitle in interface DockableFrameTitleBar
Returns:
the dockableFrame title

setIcon

public void setIcon(javax.swing.Icon icon)
Description copied from interface: DockableFrameTitleBar
Update the icon

Specified by:
setIcon in interface DockableFrameTitleBar

getIcon

public javax.swing.Icon getIcon()
Specified by:
getIcon in interface DockableFrameTitleBar
Returns:
an icon for this title bar

setBackground

public void setBackground(java.awt.Color color)
Reset the color for the background header. Use a null value for restoring the initial value

Specified by:
setBackground in interface DockableFrameTitleBar
Overrides:
setBackground in class javax.swing.JComponent

setForeground

public void setForeground(java.awt.Color color)
Reset the color for the foreground header. Use a null value for restoring the initial value

Specified by:
setForeground in interface DockableFrameTitleBar
Overrides:
setForeground in class javax.swing.JComponent

addSeparator

public void addSeparator()
Description copied from interface: DockableFrameTitleBar
Add a separator for the buttons

Specified by:
addSeparator in interface DockableFrameTitleBar

addButton

public void addButton(javax.swing.JButton button)
Description copied from interface: DockableFrameTitleBar
Add a new button for acting on the DockableFrame

Specified by:
addButton in interface DockableFrameTitleBar

addButton

public void addButton(javax.swing.JButton button,
                      boolean undecorated)

removeAllButtons

public void removeAllButtons()
Description copied from interface: DockableFrameTitleBar
Remove all buttons

Specified by:
removeAllButtons in interface DockableFrameTitleBar

prepare

public void prepare()
Description copied from interface: DockableFrameTitleBar
Prepare the title bar component to be shown once all buttons have been added

Specified by:
prepare in interface DockableFrameTitleBar

getPreferredSize

public java.awt.Dimension getPreferredSize()
Overrides:
getPreferredSize in class javax.swing.JComponent

paintComponent

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

getView

public javax.swing.JComponent getView()
Specified by:
getView in interface DockableFrameTitleBar
Returns:
the view of the title bar. This is the final component