HOME

com.ultraswing
Class TitleBar

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--com.ultraswing.CPanel
                                |
                                +--com.ultraswing.TitleBar
All Implemented Interfaces:
Accessible, ImageObserver, MenuContainer, Serializable

public class TitleBar
extends CPanel

A tile bar, with a "close" button on the right optionally.

See Also:
Serialized Form

Field Summary
 
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
TitleBar(Container parent, String title, boolean isVertical)
          Creates a TitleBar object
TitleBar(Container parent, String title, Icon icon, boolean isVertical)
          Creates a TitleBar object
TitleBar(Container parent, String title, Icon icon, boolean isVertical, boolean addCloseFrameButton)
          Creates a TitleBar object
 
Method Summary
 void addActionListener(ActionListener l)
          Adds an ActionListener for the "close" button pressed event
protected  void fireActionPerformed(ActionEvent event)
          Notifies all listeners that have registered interest for notification on this event type.
 JPanel getButtonPanel()
          Returns the JPanel on the right side of this titlebar.
 FlatButton getCloseWindowButton()
          Returns the "close" button at the end of this TitleBar
 String getTitle()
          Returns the title text string
 boolean isCloseButtonAdded()
          Returns true if "close" button is already added
 void removeActionListener(ActionListener l)
          Removes an ActionListener from the button.
 void removeCloseWindowButton()
          Removes the "close" button at the end of this TitleBar
 void setAddCloseButton(boolean b)
          If passed b is true, adds a "close" button at the end of this title bar
 void setBounds(int x, int y, int width, int height)
           
 void setBounds(Rectangle r)
           
 void setHeight(int h)
          Sets the height of this TitleBar
 void setVertical(boolean b)
          If passed b is true, this titlebar is vertical
 
Methods inherited from class com.ultraswing.CPanel
contains, getPrefferedSize, onResize, paintBorder, processComponentEvent, setBackground, setBackgroundImage, setGradientBackground
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, 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, 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, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, 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, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, 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
 

Constructor Detail

TitleBar

public TitleBar(Container parent,
                String title,
                boolean isVertical)
Creates a TitleBar object

Parameters:
parent - the parent container
title - title text
isVertical - if true, this TitleBar is vertical

TitleBar

public TitleBar(Container parent,
                String title,
                Icon icon,
                boolean isVertical)
Creates a TitleBar object

Parameters:
parent - the parent container
title - title text
icon - the small icon placed in the beginning of this title bar
isVertical - if true, this TitleBar is vertical

TitleBar

public TitleBar(Container parent,
                String title,
                Icon icon,
                boolean isVertical,
                boolean addCloseFrameButton)
Creates a TitleBar object

Parameters:
parent - the parent container
title - title text
icon - the small icon placed in the beginning of this title bar
isVertical - if true, this TitleBar is vertical
addCloseFrameButton - if true, a "close" button is placed at the end of this title bar
Method Detail

setHeight

public void setHeight(int h)
Sets the height of this TitleBar


setBounds

public void setBounds(Rectangle r)
Overrides:
setBounds in class Component

setBounds

public void setBounds(int x,
                      int y,
                      int width,
                      int height)
Overrides:
setBounds in class Component

getCloseWindowButton

public FlatButton getCloseWindowButton()
Returns the "close" button at the end of this TitleBar


removeCloseWindowButton

public void removeCloseWindowButton()
Removes the "close" button at the end of this TitleBar


getTitle

public String getTitle()
Returns the title text string


addActionListener

public void addActionListener(ActionListener l)
Adds an ActionListener for the "close" button pressed event

Parameters:
l - the ActionListener to be added

removeActionListener

public void removeActionListener(ActionListener l)
Removes an ActionListener from the button. If the listener is the currently set Action for the button, then the Action is set to null.

Parameters:
l - the listener to be removed

setAddCloseButton

public void setAddCloseButton(boolean b)
If passed b is true, adds a "close" button at the end of this title bar


isCloseButtonAdded

public boolean isCloseButtonAdded()
Returns true if "close" button is already added


getButtonPanel

public JPanel getButtonPanel()
Returns the JPanel on the right side of this titlebar. This panel contains "close" button. You can add/remove buttons.


fireActionPerformed

protected void fireActionPerformed(ActionEvent event)
Notifies all listeners that have registered interest for notification on this event type. The event instance is lazily created using the event parameter.

Parameters:
event - the ActionEvent object

setVertical

public void setVertical(boolean b)
If passed b is true, this titlebar is vertical


HOME

Copyright © 2002 iReasoning Networks. All Rights Reserved.