The Quaqua Look and Feel supports toolbars with borderless
buttons. JButton's and JToggleButton's can
be represented using their various styles.
In addition, JToggleButton's on JToolBar's support the style toolBarTab
.
This style is useful, when an application provides multiple views.
The picture and code snippets below shows a variety of styles for JToolBar's and how to achieve them.
A floatable JToolBar
on the left, containing three
JButton
s, a JSeparator
and three JToggleButton
s. All buttons have an icon,
but no text. The JSeparator
was created using method addSeparator
of the
JToolBar
.
Design Notice: Mac OS X applications usually do not use floatable tool bars, but use floating palette windows instead.
JToolBar toolBar = new JToolBar(); toolBar.setFloatable(true); ... toolBar.addSeparator();
JToggleButton videoButton = new JToggleButton(); videoButton.setIcon(anIcon); videoButton.setText(null); toolBar.add(videoButton); |
A non-floatable JToolBar
placed on the
top, containing three JButton
s, a JSeparator
and
three JToggleButton
s. All buttons have text only.
JToolBar toolBar = new JToolBar(); ... toolBar.addSeparator();
JToggleButton videoButton = new JToggleButton(); videoButton.setIcon(null); videoButton.setText("Video"); toolBar.add(videoButton);
|
A non-floatable JToolBar
placed on the
top, containing three JButton
s, a JSeparator
and
three JToggleButton
s.
All buttons have an icon and text placed below the icon. The JToggleButton
s
use the client property Quaqua.Button.style
set to toolBarTab
.
JToolBar toolBar = new JToolBar(); toolBar.setFloatable(false); ... toolBar.addSeparator();
JToggleButton videoButton = new JToggleButton(); videoButton.setIcon(anIcon); videoButton.setText("Video"); videoButton.setVerticalTextPosition(SwingConstants.BOTTOM); videoButton.setHorizontalTextPosition(SwingConstants.CENTER); videoButton.putClientProperty( "Quaqua.Button.style", "toolBarTab" ); toolBar.add(videoButton);
|
A non-floatable JToolBar
placed on the
top, containing three JButton
s, a JSeparator
and
three JToggleButton
s. All buttons have text only, the font
is set to Lucida Grande 11 (the AHIG
"Small system font"). The JToggleButton
s
use the client property Quaqua.Button.style
to
create a "segmented control" look.
JToolBar toolBar = new JToolBar(); toolBar.setFloatable(false); ... toolBar.addSeparator();
Font smallSystemFont = new Font("Lucide Grande", Font.PLAIN, 11);
JToggleButton videoButton = new JToggleButton(); videoButton.setText("Video"); videoButton.setFont(smallSystemFont); videoButton.putClientProperty( "Quaqua.Button.style", "toggleWest" ); toolBar.add(videoButton);
JToggleButton structButton = new JToggleButton(); structButton.setText("Struct"); structButton.setFont(smallSystemFont); structButton.putClientProperty( "Quaqua.Button.style", "toggleCenter" ); toolBar.add(structButton);
JToggleButton binaryButton = new JToggleButton(); binaryButton.setText("Binary"); binaryButton.setFont(smallSystemFont); binaryButton.putClientProperty( "Quaqua.Button.style", "toggleEast" ); toolBar.add(binaryButton);
|