|
|||||||||
| Home >> All >> com >> javathis >> utilities >> [ ui overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.javathis.utilities.ui
Class JTToolBar

java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JToolBar
com.javathis.utilities.ui.JTToolBar
- All Implemented Interfaces:
- javax.accessibility.Accessible, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.event.MouseListener, java.beans.PropertyChangeListener, java.io.Serializable, javax.swing.SwingConstants
- public class JTToolBar
- extends javax.swing.JToolBar
- implements java.awt.event.MouseListener, java.beans.PropertyChangeListener
- extends javax.swing.JToolBar
A JTToolBar works exactly the same as a javax.swing.JToolBar with
additional ability to change it's appearance.
Currently the only supported appearances are normal and flat. Normal is the default and makes it look and act just like a JToolBar. However setting it to flat makes it act more like a Microsoft tool bar.
Flat appearance has shows all the buttons with no borders, and only when the mouse pointer goes over it will it appear to popup. The separators appear as lines instead of spaces between the buttons.
Setting the appearance can be done one of two ways. Either by providing the
desired appearance byte with the corresponding constructor, or
to the setAppearance(byte) 55 method.
A special feature of a JTToolBar is that when it is set to be
floatable and you drag-out the tool bar, it will not let you dock it on a side
that already contains a component. (This has been approved as RFE 4664642
with Sun, however still not implemented.)
For drag-out to work correctly it requires a java.awt.BorderLayout for the tool bar's container.
Note: I do not know how this will look or preform on a MAC. If anyone has a MAC, especially one with OS X, please let me know.
Note: This component was created because the javax.swing.JToolBar provided with JDK 1.4.0 is supposed to function as the appearance does by it's rollover methods. However, there are bugs present in the 1.4.0 release that prevent this from working correctly in the Windows LnF. Also separators do not function as they should. Especially when the tool bar is docked on the east or west. Also the separators in the JToolBar are always a bar regardless of the rollover setting. This does not conform existing standards. The separator should only be a bar when the buttons are in a flat appearance other wise they should be a empty space.
A detailed bug report was submitted to Sun, still awaiting it to be reviewed and posted. Once it is posted, a link will be provided here.
Please notify me of non standard behavior of this component in LnF's other than Windows. Since I not well versed in their standards.
| Nested Class Summary | |
class |
JTToolBar.BasicJTToolBarUI
|
private class |
JTToolBar.JTSeparator
|
private class |
JTToolBar.JTToolBarLayout
|
class |
JTToolBar.MetalJTToolBarUI
|
class |
JTToolBar.WindowsJTToolBarUI
|
| Nested classes inherited from class javax.swing.JToolBar |
javax.swing.JToolBar.AccessibleJToolBar, javax.swing.JToolBar.Separator |
| Nested classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
| Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
| Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
private byte |
appearance
|
static byte |
APPEARANCE_FLAT
|
static byte |
APPEARANCE_NORMAL
|
private static javax.swing.border.Border |
BUTTON_FLAT_BORDER
|
private static javax.swing.border.Border |
BUTTON_NORMAL_BORDER
|
private boolean |
isDirty
|
private static java.util.ResourceBundle |
MAIN_RESOURCE_BUNDLE
|
private static java.lang.String |
uiClassID
|
| Fields inherited from class javax.swing.JToolBar |
|
| 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.Container |
|
| Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface javax.swing.SwingConstants |
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
| Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
JTToolBar()
Creates a new tool bar; orientation defaults to HORIZONTAL,
and appeance to APPEARANCE_NORMAL. |
|
JTToolBar(byte appearance)
Creates a new tool bar with the specified appeance and
orientation defaults to HORIZONTAL. |
|
JTToolBar(int orientation)
Creates a new tool bar with the specified orientation and
appeance defaults to APPEARANCE_NORMAL. |
|
JTToolBar(java.lang.String name)
Creates a new tool bar with the specified name. |
|
JTToolBar(java.lang.String name,
byte appearance)
Creates a new tool bar with a specified name and
appearance with orientation defaulting
HORIZONTAL. |
|
JTToolBar(java.lang.String name,
int orientation)
Creates a new tool bar with a specified name and
orientation with appeance defaulting
APPEARANCE_NORMAL. |
|
JTToolBar(java.lang.String name,
int orientation,
byte appearance)
Creates a new tool bar with a specified name,
orientation, and appearance. |
|
| Method Summary | |
protected void |
addImpl(java.awt.Component component,
java.lang.Object constraints,
int index)
If an javax.swing.AbstractButton is being added, it is modified to handle the current appearance of the tool bar. |
void |
addSeparator()
Appends a separator of default size to the end of the tool bar. |
void |
addSeparator(java.awt.Dimension size)
Appends a separator of a specified size to the end of the tool bar. |
private boolean |
canDock(javax.swing.plaf.basic.BasicToolBarUI ui,
java.awt.Component component,
java.awt.Point point)
|
byte |
getAppearance()
Returns the byte representing the current appearance of the
tool bar. |
boolean |
isRollover()
Returns true if the appearance is flat. |
static void |
main(java.lang.String[] args)
|
void |
mouseClicked(java.awt.event.MouseEvent e)
This method is called when the mouse is clicked (pressed and released in short succession) on a component. |
void |
mouseEntered(java.awt.event.MouseEvent e)
This method is called when the mouse enters a component. |
void |
mouseExited(java.awt.event.MouseEvent e)
This method is called when the mouse exits a component. |
void |
mousePressed(java.awt.event.MouseEvent e)
This method is called when the mouse is pressed over a component. |
void |
mouseReleased(java.awt.event.MouseEvent e)
This method is called when the mouse is released over a component. |
void |
propertyChange(java.beans.PropertyChangeEvent e)
Fired after a Bean's property has changed. |
void |
setAppearance(byte appearance)
Changes the appearance of the tool bar. |
void |
setRollover(boolean rollover)
Deligates to setAppearance(byte) 55 changing appearance to flat if
the provided rollover value is true, and normal otherwise. |
private void |
updateButtons()
Used to handle all the buttons if the appearance is changed on the fly. |
void |
updateUI()
Notification from the UIFactory that the L&F has changed. |
private void |
updateUIDefaults(javax.swing.LookAndFeel newLnF)
|
| Methods inherited from class javax.swing.JToolBar |
add, createActionChangeListener, createActionComponent, getAccessibleContext, getComponentAtIndex, getComponentIndex, getMargin, getOrientation, getUI, getUIClassID, isBorderPainted, isFloatable, paintBorder, paramString, setBorderPainted, setFloatable, setLayout, setMargin, setOrientation, setUI |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
uiClassID
private static final java.lang.String uiClassID
- See Also:
- Constant Field Values
MAIN_RESOURCE_BUNDLE
private static final java.util.ResourceBundle MAIN_RESOURCE_BUNDLE
APPEARANCE_FLAT
public static final byte APPEARANCE_FLAT
- See Also:
- Constant Field Values
APPEARANCE_NORMAL
public static final byte APPEARANCE_NORMAL
- See Also:
- Constant Field Values
BUTTON_FLAT_BORDER
private static final javax.swing.border.Border BUTTON_FLAT_BORDER
BUTTON_NORMAL_BORDER
private static final javax.swing.border.Border BUTTON_NORMAL_BORDER
isDirty
private boolean isDirty
appearance
private byte appearance
| Constructor Detail |
JTToolBar
public JTToolBar()
- Creates a new tool bar; orientation defaults to
HORIZONTAL, and appeance toAPPEARANCE_NORMAL.Note: Delegates to the following constructor:
JTToolBar(String, int, byte)
JTToolBar
public JTToolBar(int orientation)
- Creates a new tool bar with the specified
orientationand appeance defaults toAPPEARANCE_NORMAL. Theorientationmust be eitherHORIZONTALorVERTICAL.Note: Delegates to the following constructor:
JTToolBar(String, int, byte)
JTToolBar
public JTToolBar(byte appearance)
- Creates a new tool bar with the specified
appeanceand orientation defaults toHORIZONTAL. Theappeancemust be eitherAPPEARANCE_NORMALorAPPEARANCE_FLAT.Note: Delegates to the following constructor:
JTToolBar(String, int, byte)
JTToolBar
public JTToolBar(java.lang.String name)
- Creates a new tool bar with the specified
name. The name is used as the title of the undocked tool bar. The default orientation isHORIZONTALand appeance isAPPEARANCE_NORMAL.Note: Delegates to the following constructor:
JTToolBar(String, int, byte)
JTToolBar
public JTToolBar(java.lang.String name, int orientation)
- Creates a new tool bar with a specified
nameandorientationwith appeance defaultingAPPEARANCE_NORMAL.Note: Delegates to the following constructor:
JTToolBar(String, int, byte)
JTToolBar
public JTToolBar(java.lang.String name, byte appearance)
- Creates a new tool bar with a specified
nameandappearancewith orientation defaultingHORIZONTAL.Note: Delegates to the following constructor:
JTToolBar(String, int, byte)
JTToolBar
public JTToolBar(java.lang.String name, int orientation, byte appearance)
- Creates a new tool bar with a specified
name,orientation, andappearance. All other constructors call this constructor.Note: If
orientationorappearanceis an invalid value, an java.lang.IllegalArgumentException will be thrown.
| Method Detail |
setAppearance
public void setAppearance(byte appearance)
- Changes the appearance of the tool bar.
Currently the only supported appearances are normal and flat. Normal is the makes it look and act just like a JToolBar. However setting it to flat makes it show all the buttons with no borders, and only when the mouse pointer goes over it will it appear to popup. The separators appear as lines instead of spaces between the buttons.
Note: If
orientationorappearanceis an invalid value, an java.lang.IllegalArgumentException will be thrown.
getAppearance
public byte getAppearance()
- Returns the
byterepresenting the current appearance of the tool bar.
setRollover
public void setRollover(boolean rollover)
- Deligates to
setAppearance(byte)55 changing appearance to flat if the providedrollovervalue is true, and normal otherwise.
isRollover
public boolean isRollover()
- Returns true if the appearance is flat. Overridded to work with the
appearance methodology.
mousePressed
public void mousePressed(java.awt.event.MouseEvent e)
- Description copied from interface:
java.awt.event.MouseListener - This method is called when the mouse is pressed over a component.
- Specified by:
mousePressedin interfacejava.awt.event.MouseListener
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent e)
- Description copied from interface:
java.awt.event.MouseListener - This method is called when the mouse is released over a component.
- Specified by:
mouseReleasedin interfacejava.awt.event.MouseListener
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent e)
- Description copied from interface:
java.awt.event.MouseListener - This method is called when the mouse enters a component.
- Specified by:
mouseEnteredin interfacejava.awt.event.MouseListener
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent e)
- Description copied from interface:
java.awt.event.MouseListener - This method is called when the mouse is clicked (pressed and released
in short succession) on a component.
- Specified by:
mouseClickedin interfacejava.awt.event.MouseListener
mouseExited
public void mouseExited(java.awt.event.MouseEvent e)
- Description copied from interface:
java.awt.event.MouseListener - This method is called when the mouse exits a component.
- Specified by:
mouseExitedin interfacejava.awt.event.MouseListener
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent e)
- Description copied from interface:
java.beans.PropertyChangeListener - Fired after a Bean's property has changed.
- Specified by:
propertyChangein interfacejava.beans.PropertyChangeListener
addSeparator
public void addSeparator()
- Appends a separator of default size to the end of the tool bar.
The default size is determined by the current look and feel.
addSeparator
public void addSeparator(java.awt.Dimension size)
- Appends a separator of a specified size to the end
of the tool bar.
updateUI
public void updateUI()
- Notification from the
UIFactorythat the L&F has changed. Called to replace the UI with the latest version from theUIFactory.
addImpl
protected void addImpl(java.awt.Component component, java.lang.Object constraints, int index)
- If an javax.swing.AbstractButton is being added, it is modified to handle
the current appearance of the tool bar.
updateUIDefaults
private void updateUIDefaults(javax.swing.LookAndFeel newLnF)
canDock
private boolean canDock(javax.swing.plaf.basic.BasicToolBarUI ui, java.awt.Component component, java.awt.Point point)
updateButtons
private void updateButtons()
- Used to handle all the buttons if the appearance is changed on the fly.
main
public static void main(java.lang.String[] args)
|
|||||||||
| Home >> All >> com >> javathis >> utilities >> [ ui overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC