3261N/A * Copyright (c) 2002, 2010, Oracle and/or its affiliates. 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 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle 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. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * SynthLookAndFeel provides the basis for creating a customized look and 0N/A * feel. SynthLookAndFeel does not directly provide a look, all painting is 0N/A * You need to either provide a configuration file, by way of the 0N/A * {@link #load} method, or provide your own {@link SynthStyleFactory} 0N/A * to {@link #setStyleFactory}. Refer to the 0N/A * loading a file, and {@link javax.swing.plaf.synth.SynthStyleFactory} for 0N/A * an example of providing your own <code>SynthStyleFactory</code> to 0N/A * <code>setStyleFactory</code>. 0N/A * <strong>Warning:</strong> 0N/A * This class implements {@link Serializable} as a side effect of it 0N/A * extending {@link BasicLookAndFeel}. It is not intended to be serialized. 0N/A * An attempt to serialize it will 0N/A * result in {@link NotSerializableException}. 0N/A * @author Scott Violet 0N/A * Used in a handful of places where we need an empty Insets. 0N/A * AppContext key to get the current SynthStyleFactory. 5088N/A * AppContext key to get selectedUI. 5088N/A * AppContext key to get selectedUIState. 0N/A * The last SynthStyleFactory that was asked for from AppContext 0N/A * <code>lastContext</code>. 0N/A * AppContext lastLAF came from. 0N/A * SynthStyleFactory for the this SynthLookAndFeel. 0N/A * Map of defaults table entries. This is populated via the load 0N/A * Used by the renderers. For the most part the renderers are implemented 0N/A * as Labels, which is problematic in so far as they are never selected. 0N/A * To accomodate this SynthLabelUI checks if the current 0N/A * UI matches that of <code>selectedUI</code> (which this methods sets), if 0N/A * it does, then a state as set by this method is returned. This provides 0N/A * a way for labels to have a state other than selected. 0N/A * Clears out the selected UI that was last set in setSelectedUI. 0N/A * Sets the SynthStyleFactory that the UI classes provided by 0N/A * synth will use to obtain a SynthStyle. 0N/A * @param cache SynthStyleFactory the UIs should use. 0N/A // We assume the setter is called BEFORE the getter has been invoked 0N/A // for a particular AppContext. 0N/A * Returns the current SynthStyleFactory. 0N/A * @return SynthStyleFactory 0N/A * Returns the component state for the specified component. This should 0N/A * only be used for Components that don't have any special state beyond 0N/A * that of ENABLED, DISABLED or FOCUSED. For example, buttons shouldn't 0N/A * call into this method. 0N/A * Gets a SynthStyle for the specified region of the specified component. 0N/A * This is not for general consumption, only custom UIs should call this 0N/A * @param c JComponent to get the SynthStyle for 0N/A * @param region Identifies the region of the specified component 0N/A * @return SynthStyle to use. 0N/A * Returns true if the Style should be updated in response to the 0N/A * specified PropertyChangeEvent. This forwards to 0N/A * <code>shouldUpdateStyleOnAncestorChanged</code> as necessary. 0N/A * A convience method that will reset the Style of StyleContext if 0N/A * Updates the style associated with <code>c</code>, and all its children. 0N/A * This is a lighter version of 0N/A * <code>SwingUtilities.updateComponentTreeUI</code>. 0N/A * @param c Component to update style for. 0N/A // Yes, this is hacky. A better solution is to get the UI 0N/A // and cast, but JComponent doesn't expose a getter for the UI 0N/A // (each of the UIs do), making that approach impractical. 0N/A * Returns the Region for the JComponent <code>c</code>. 0N/A * @param c JComponent to fetch the Region for 0N/A * @return Region corresponding to <code>c</code> 0N/A * A convenience method to return where the foreground should be 0N/A * painted for the Component identified by the passed in 0N/A * AbstractSynthContext. 0N/A * A convenience method that handles painting of the background. 0N/A * All SynthUI implementations should override update and invoke 0N/A * A convenience method that handles painting of the background for 0N/A * subregions. All SynthUI's that have subregions should invoke 0N/A * this method, than paint the foreground. 0N/A // Fill in the background, if necessary. 0N/A * Returns the ui that is of type <code>klass</code>, or null if 0N/A * one can not be found. 0N/A * Creates the Synth look and feel <code>ComponentUI</code> for 0N/A * the passed in <code>JComponent</code>. 0N/A * @param c JComponent to create the <code>ComponentUI</code> for 0N/A * @return ComponentUI to use for <code>c</code> 0N/A else if (
key ==
"CheckBoxUI") {
0N/A else if (
key ==
"CheckBoxMenuItemUI") {
0N/A else if (
key ==
"ColorChooserUI") {
0N/A else if (
key ==
"ComboBoxUI") {
0N/A else if (
key ==
"DesktopPaneUI") {
0N/A else if (
key ==
"DesktopIconUI") {
0N/A else if (
key ==
"EditorPaneUI") {
0N/A else if (
key ==
"FileChooserUI") {
0N/A else if (
key ==
"FormattedTextFieldUI") {
0N/A else if (
key ==
"InternalFrameUI") {
0N/A else if (
key ==
"MenuBarUI") {
0N/A else if (
key ==
"MenuItemUI") {
0N/A else if (
key ==
"OptionPaneUI") {
0N/A else if (
key ==
"PasswordFieldUI") {
0N/A else if (
key ==
"PopupMenuSeparatorUI") {
0N/A else if (
key ==
"PopupMenuUI") {
0N/A else if (
key ==
"ProgressBarUI") {
0N/A else if (
key ==
"RadioButtonUI") {
0N/A else if (
key ==
"RadioButtonMenuItemUI") {
0N/A else if (
key ==
"RootPaneUI") {
0N/A else if (
key ==
"ScrollBarUI") {
0N/A else if (
key ==
"ScrollPaneUI") {
0N/A else if (
key ==
"SeparatorUI") {
0N/A else if (
key ==
"SpinnerUI") {
0N/A else if (
key ==
"SplitPaneUI") {
0N/A else if (
key ==
"TabbedPaneUI") {
0N/A else if (
key ==
"TableHeaderUI") {
0N/A else if (
key ==
"TextAreaUI") {
0N/A else if (
key ==
"TextFieldUI") {
0N/A else if (
key ==
"TextPaneUI") {
0N/A else if (
key ==
"ToggleButtonUI") {
0N/A else if (
key ==
"ToolBarSeparatorUI") {
0N/A else if (
key ==
"ToolBarUI") {
0N/A else if (
key ==
"ToolTipUI") {
0N/A else if (
key ==
"ViewportUI") {
0N/A * Creates a SynthLookAndFeel. 0N/A * For the returned <code>SynthLookAndFeel</code> to be useful you need to 0N/A * invoke <code>load</code> to specify the set of 0N/A * <code>SynthStyle</code>s, or invoke <code>setStyleFactory</code>. 0N/A * @see #setStyleFactory 0N/A * Loads the set of <code>SynthStyle</code>s that will be used by 0N/A * this <code>SynthLookAndFeel</code>. <code>resourceBase</code> is 0N/A * used to resolve any path based resources, for example an 0N/A * <code>Image</code> would be resolved by 0N/A * <code>resourceBase.getResource(path)</code>. Refer to 0N/A * for more information. 0N/A * @param input InputStream to load from 0N/A * @param resourceBase used to resolve any images or other resources 0N/A * @throws ParseException if there is an error in parsing 0N/A * @throws IllegalArgumentException if input or resourceBase is <code>null</code> 0N/A "You must supply a valid resource base Class");
0N/A * Loads the set of <code>SynthStyle</code>s that will be used by 0N/A * this <code>SynthLookAndFeel</code>. Path based resources are resolved 0N/A * relatively to the specified <code>URL</code> of the style. For example 0N/A * an <code>Image</code> would be resolved by 0N/A * <code>new URL(synthFile, path)</code>. Refer to 0N/A * @param url the <code>URL</code> to load the set of 0N/A * <code>SynthStyle</code> from 0N/A * @throws ParseException if there is an error in parsing 0N/A * @throws IllegalArgumentException if synthSet is <code>null</code> 0N/A * @throws IOException if synthSet cannot be opened as an <code>InputStream</code> 0N/A "You must supply a valid Synth set URL");
0N/A * Called by UIManager when this look and feel is installed. 0N/A * Called by UIManager when this look and feel is uninstalled. 0N/A // We should uninstall the StyleFactory here, but unfortunately 0N/A // there are a handful of things that retain references to the 0N/A // LookAndFeel and expect things to work 0N/A * Returns the defaults for this SynthLookAndFeel. 0N/A * @return Defaults table. 0N/A "com.sun.swing.internal.plaf.basic.resources.basic" );
0N/A // SynthTabbedPaneUI supports rollover on tabs, GTK does not 0N/A // These need to be defined for JColorChooser to work. 2212N/A // These need to be defined for ImageView. 0N/A // These are needed for PopupMenu. 0N/A "DOWN",
"selectNext",
0N/A "KP_DOWN",
"selectNext",
0N/A "UP",
"selectPrevious",
0N/A "KP_UP",
"selectPrevious",
0N/A "LEFT",
"selectParent",
0N/A "KP_LEFT",
"selectParent",
0N/A "RIGHT",
"selectChild",
0N/A "KP_RIGHT",
"selectChild",
0N/A table.
put(
"PopupMenu.selectedWindowInputMapBindings.RightToLeft",
0N/A "LEFT",
"selectChild",
0N/A "KP_LEFT",
"selectChild",
0N/A "RIGHT",
"selectParent",
0N/A "KP_RIGHT",
"selectParent",
0N/A // enabled antialiasing depending on desktop settings 0N/A * Returns true, SynthLookAndFeel is always supported. 0N/A * Returns false, SynthLookAndFeel is not a native look and feel. 0N/A * Returns a textual description of SynthLookAndFeel. 0N/A * @return textual description of synth. 0N/A return "Synth look and feel";
0N/A * Return a short string that identifies this look and feel. 0N/A * @return a short string identifying this look and feel. 0N/A return "Synth look and feel";
0N/A * Return a string that identifies this look and feel. 0N/A * @return a short string identifying this look and feel. 0N/A * Returns whether or not the UIs should update their 0N/A * <code>SynthStyles</code> from the <code>SynthStyleFactory</code> 0N/A * when the ancestor of the <code>JComponent</code> changes. A subclass 0N/A * that provided a <code>SynthStyleFactory</code> that based the 0N/A * return value from <code>getStyle</code> off the containment hierarchy 0N/A * would override this method to return true. 0N/A * @return whether or not the UIs should update their 0N/A * <code>SynthStyles</code> from the <code>SynthStyleFactory</code> 0N/A * when the ancestor changed. 1999N/A * Returns whether or not the UIs should update their styles when a 1999N/A * @param ev a {@code PropertyChangeEvent} 1999N/A * @return whether or not the UIs should update their styles 1999N/A // Only update on an ancestor change when getting a valid 1999N/A // parent and the LookAndFeel wants this. 0N/A * Returns the antialiasing information as specified by the host desktop. 0N/A * Antialiasing might be forced off if the desktop is GNOME and the user 0N/A * has set his locale to Chinese, Japanese or Korean. This is consistent 0N/A * for more information about CJK and antialiased fonts. 0N/A * @return the text antialiasing information associated to the desktop 0N/A * Updates the UI of the passed in window and all its children. 0N/A * Updates the UIs of all the known Frames. 0N/A * Indicates if an updateUI call is pending. 0N/A * Sets whether or not an updateUI call is pending. 0N/A * Returns true if a UI update is pending. 0N/A // De-register listener on old keyboard focus manager and 0N/A // register it on the new one. 0N/A * This is a support method that will check if the background colors of 0N/A * the specified component differ between focused and unfocused states. 0N/A * If the color differ the component will then repaint itself. 0N/A * @comp the component to check 0N/A // Get the current background color. 0N/A // Get the last background color. 0N/A // Reset the component state back to original. 0N/A // Repaint the component if the backgrounds differed.