SynthToolBarUI.java revision 2146
0N/A * Copyright 2002-2006 Sun Microsystems, Inc. All Rights Reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. Sun designates this 0N/A * particular file as subject to the "Classpath" exception as provided 0N/A * by Sun in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 0N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 0N/A * CA 95054 USA or visit www.sun.com if you need additional information or 0N/A * have any questions. 1999N/A * Provides the Synth L&F UI delegate for 1999N/A * {@link javax.swing.JToolBar}. 1999N/A * Creates a new UI object for the given component. 1999N/A * @param c component to create UI object for 1999N/A * Creates a {@code LayoutManager} to use with the toolbar. 1999N/A * @return a {@code LayoutManager} instance 2146N/A * Notifies this UI delegate to repaint the specified component. 2146N/A * This method paints the component background, then calls 2146N/A * the {@link #paint(SynthContext,Graphics)} method. 2146N/A * <p>In general, this method does not need to be overridden by subclasses. 2146N/A * All Look and Feel rendering code should reside in the {@code paint} method. 2146N/A * @param g the {@code Graphics} object used for painting 2146N/A * @param c the component being painted 2146N/A * @see #paint(SynthContext,Graphics) 2146N/A * Paints the specified component according to the Look and Feel. 2146N/A * <p>This method is not used by Synth Look and Feel. 2146N/A * Painting is handled by the {@link #paint(SynthContext,Graphics)} method. 2146N/A * @param g the {@code Graphics} object used for painting 2146N/A * @param c the component being painted 2146N/A * @see #paint(SynthContext,Graphics) 0N/A int y,
int w,
int h) {
0N/A // Overloaded to do nothing so we can share listeners. 0N/A // Overloaded to do nothing so we can share listeners. 0N/A // Overloaded to do nothing so we can share listeners. 1999N/A * @param context context for the component being painted 2146N/A * @param g the {@code Graphics} object used for painting 2146N/A * @see #update(Graphics,JComponent) 1999N/A * Paints the toolbar content. 1999N/A * @param context context for the component being painted 1999N/A * @param g {@code Graphics} object used for painting 1999N/A * @param bounds bounding box for the toolbar 0N/A // PropertyChangeListener 1173N/A // JToolBar by default uses a somewhat modified BoxLayout as 1173N/A // its layout manager. For compatibility reasons, we want to 1173N/A // support Box "glue" as a way to move things around on the 1173N/A // toolbar. "glue" is represented in BoxLayout as a Box.Filler 1173N/A // with a minimum and preferred size of (0,0). 1173N/A // So what we do here is find the number of such glue fillers 1173N/A // and figure out how much space should be allocated to them. 0N/A // Note: contentRect does not take insets into account 0N/A // since it is used for determining the bounds that are 0N/A // passed to paintToolBarContentBackground(). 0N/A // However, we do take the insets into account here for 0N/A // the purposes of laying out the toolbar child components. 1173N/A // we need to get the minimum width for laying things out 1173N/A // so that we can calculate how much empty space needs to 1173N/A // be distributed among the "glue", if any 0N/A // Fill available height 0N/A // Center component vertically in the available space 1173N/A //if the component is a "glue" component then add to its 1173N/A //width the extraSpacePerGlue it is due 0N/A // See notes above regarding the use of insets 1173N/A // we need to get the minimum height for laying things out 1173N/A // so that we can calculate how much empty space needs to 1173N/A // be distributed among the "glue", if any 0N/A // Fill available width 0N/A // Center component horizontally in the available space 1173N/A //if the component is a "glue" component then add to its 1173N/A //height the extraSpacePerGlue it is due