Imported GNU Classpath 0.90
Imported GNU Classpath 0.90 * scripts/makemake.tcl: LocaleData.java moved to gnu/java/locale. * sources.am: Regenerated. * gcj/javaprims.h: Regenerated. * Makefile.in: Regenerated. * gcj/Makefile.in: Regenerated. * include/Makefile.in: Regenerated. * testsuite/Makefile.in: Regenerated. * gnu/java/lang/VMInstrumentationImpl.java: New override. * gnu/java/net/local/LocalSocketImpl.java: Likewise. * gnu/classpath/jdwp/VMMethod.java: Likewise. * gnu/classpath/jdwp/VMVirtualMachine.java: Update to latest interface. * java/lang/Thread.java: Add UncaughtExceptionHandler. * java/lang/reflect/Method.java: Implements GenericDeclaration and isSynthetic(), * java/lang/reflect/Field.java: Likewise. * java/lang/reflect/Constructor.java * java/lang/Class.java: Implements Type, GenericDeclaration, getSimpleName() and getEnclosing*() methods. * java/lang/Class.h: Add new public methods. * java/lang/Math.java: Add signum(), ulp() and log10(). * java/lang/natMath.cc (log10): New function. * java/security/VMSecureRandom.java: New override. * java/util/logging/Logger.java: Updated to latest classpath version. * java/util/logging/LogManager.java: New override. From-SVN: r113887
This commit is contained in:
parent
eaec4980e1
commit
4f9533c772
1640 changed files with 126485 additions and 104808 deletions
|
@ -1,5 +1,5 @@
|
|||
/* LookAndFeel.java --
|
||||
Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2004, 2005, 2006, Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
|
@ -49,15 +49,25 @@ import javax.swing.plaf.ComponentInputMapUIResource;
|
|||
import javax.swing.plaf.IconUIResource;
|
||||
import javax.swing.plaf.InputMapUIResource;
|
||||
import javax.swing.plaf.UIResource;
|
||||
import javax.swing.plaf.metal.MetalLookAndFeel;
|
||||
import javax.swing.text.JTextComponent;
|
||||
|
||||
/**
|
||||
* A <i>look-and-feel</i> controls most aspects of the appearance and
|
||||
* operation of user interface components in <code>javax.swing</code>. A
|
||||
* cross-platform look-and-feel (the {@link MetalLookAndFeel}) is provided.
|
||||
*
|
||||
* @see UIManager#getInstalledLookAndFeels()
|
||||
* @see UIManager#setLookAndFeel(LookAndFeel)
|
||||
*/
|
||||
public abstract class LookAndFeel
|
||||
{
|
||||
/**
|
||||
* This method is called once by UIManager.setLookAndFeel to create
|
||||
* the look and feel specific defaults table.
|
||||
* Creates and returns a look-and-feel specific defaults table. This method
|
||||
* is called once by {@link UIManager#setLookAndFeel(LookAndFeel)} and
|
||||
* shouldn't be called again (as it creates a large table of defaults).
|
||||
*
|
||||
* @return the UI defaults
|
||||
* @return The UI defaults.
|
||||
*/
|
||||
public UIDefaults getDefaults()
|
||||
{
|
||||
|
@ -71,10 +81,21 @@ public abstract class LookAndFeel
|
|||
*/
|
||||
public abstract String getDescription();
|
||||
|
||||
/**
|
||||
* Returns the value of <code>Toolkit.getDefaultToolkit()
|
||||
* .getDesktopProperty(systemPropertyName)</code>, or
|
||||
* <code>fallbackValue</code> if no such property is defined.
|
||||
*
|
||||
* @param systemPropertyName the system property name.
|
||||
* @param fallbackValue the fallback value.
|
||||
*
|
||||
* @return The property value or <code>fallbackValue</code>.
|
||||
*/
|
||||
public static Object getDesktopPropertyValue(String systemPropertyName,
|
||||
Object fallbackValue)
|
||||
{
|
||||
Object value = Toolkit.getDefaultToolkit().getDesktopProperty(systemPropertyName);
|
||||
Object value = Toolkit.getDefaultToolkit().getDesktopProperty(
|
||||
systemPropertyName);
|
||||
return value != null ? value : fallbackValue;
|
||||
}
|
||||
|
||||
|
@ -93,11 +114,12 @@ public abstract class LookAndFeel
|
|||
public abstract String getName();
|
||||
|
||||
/**
|
||||
* Returns true when the Look and Feel supports window decorations,
|
||||
* false others. This method returns always false and needs to be overwritten
|
||||
* when the derived Look and Feel supports this.
|
||||
* Returns <code>true</code> when the look-and-feel supports window
|
||||
* decorations, and <code>false</code> otherwise. This default implementation
|
||||
* always returns <code>false</code> and needs to be overridden when the
|
||||
* derived look-and-feel supports this.
|
||||
*
|
||||
* @return false
|
||||
* @return <code>false</code>.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
|
@ -107,8 +129,11 @@ public abstract class LookAndFeel
|
|||
}
|
||||
|
||||
/**
|
||||
* UIManager.setLookAndFeel calls this method before the first call
|
||||
* (and typically the only call) to getDefaults().
|
||||
* Initializes the look-and-feel. The
|
||||
* {@link UIManager#setLookAndFeel(LookAndFeel)} method calls this method
|
||||
* before the first call (and typically the only call) to
|
||||
* {@link #getDefaults()}. This default implementation does nothing, but
|
||||
* subclasses can override this behaviour.
|
||||
*/
|
||||
public void initialize()
|
||||
{
|
||||
|
@ -117,9 +142,13 @@ public abstract class LookAndFeel
|
|||
}
|
||||
|
||||
/**
|
||||
* Convenience method for installing a component's default Border object
|
||||
* on the specified component if either the border is currently null
|
||||
* or already an instance of UIResource.
|
||||
* Convenience method for installing a component's default {@link Border}
|
||||
* object on the specified component if either the border is currently
|
||||
* <code>null</code> or already an instance of {@link UIResource}.
|
||||
*
|
||||
* @param c the component (<code>null</code> not permitted).
|
||||
* @param defaultBorderName the border name (for lookup in the UIDefaults
|
||||
* table).
|
||||
*/
|
||||
public static void installBorder(JComponent c, String defaultBorderName)
|
||||
{
|
||||
|
@ -131,6 +160,12 @@ public abstract class LookAndFeel
|
|||
/**
|
||||
* Convenience method for initializing a component's foreground and
|
||||
* background color properties with values from the current defaults table.
|
||||
*
|
||||
* @param c the component (<code>null</code> not permitted).
|
||||
* @param defaultBgName the key for the background color in the UIDefaults
|
||||
* table.
|
||||
* @param defaultFgName the key for the foreground color in the UIDefaults
|
||||
* table.
|
||||
*/
|
||||
public static void installColors(JComponent c, String defaultBgName,
|
||||
String defaultFgName)
|
||||
|
@ -147,8 +182,15 @@ public abstract class LookAndFeel
|
|||
}
|
||||
|
||||
/**
|
||||
* Convenience method for initializing a components foreground background
|
||||
* and font properties with values from the current defaults table.
|
||||
* Convenience method for initializing a component's foreground, background
|
||||
* and font properties with values from the current defaults table.
|
||||
*
|
||||
* @param component the component (<code>null</code> not permitted).
|
||||
* @param defaultBgName the key for the background color in the UIDefaults
|
||||
* table.
|
||||
* @param defaultFgName the key for the foreground color in the UIDefaults
|
||||
* table.
|
||||
* @param defaultFontName the key for the font in the UIDefaults table.
|
||||
*/
|
||||
public static void installColorsAndFont(JComponent component,
|
||||
String defaultBgName,
|
||||
|
@ -164,8 +206,10 @@ public abstract class LookAndFeel
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> if the look and feel is the "native" look and
|
||||
* feel for the current platform, and <code>false</code> otherwise.
|
||||
* Returns <code>true</code> if the look-and-feel is the "native"
|
||||
* look-and-feel for the current platform, and <code>false</code> otherwise.
|
||||
* A native look-and-feel emulates the appearance and behaviour of the
|
||||
* default windowing system on the host operating system.
|
||||
*
|
||||
* @return A flag indicating whether or not this is the native look and feel
|
||||
* for the current platform.
|
||||
|
@ -173,13 +217,13 @@ public abstract class LookAndFeel
|
|||
public abstract boolean isNativeLookAndFeel();
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> if the look and feel is supported on the
|
||||
* Returns <code>true</code> if the look-and-feel is supported on the
|
||||
* current operating system, and <code>false</code> otherwise. This
|
||||
* mechanism is provided so that it is possible to prevent a look and feel
|
||||
* mechanism is provided so that it is possible to prevent a look-and-feel
|
||||
* from being used on some operating systems (usually for legal, not
|
||||
* technical, reasons).
|
||||
*
|
||||
* @return A flag indicating whether or not the look and feel is supported
|
||||
* @return A flag indicating whether or not the look-and-feel is supported
|
||||
* on the current platform.
|
||||
*/
|
||||
public abstract boolean isSupportedLookAndFeel();
|
||||
|
@ -219,6 +263,8 @@ public abstract class LookAndFeel
|
|||
*
|
||||
* @param c the JComponent associated with the ComponentInputMap
|
||||
* @param keys the Object array describing the InputMap as above
|
||||
*
|
||||
* @return A new input map.
|
||||
*/
|
||||
public static ComponentInputMap makeComponentInputMap(JComponent c,
|
||||
Object[] keys)
|
||||
|
@ -230,7 +276,13 @@ public abstract class LookAndFeel
|
|||
|
||||
/**
|
||||
* Utility method that creates a UIDefaults.LazyValue that creates an
|
||||
* ImageIcon UIResource for the specified gifFile filename.
|
||||
* ImageIcon UIResource for the specified gifFile filename.
|
||||
*
|
||||
* @param baseClass the base class for accessing the icon resource.
|
||||
* @param gifFile the file name.
|
||||
*
|
||||
* @return A {@link UIDefaults.LazyValue} that serves up an
|
||||
* {@link IconUIResource}.
|
||||
*/
|
||||
public static Object makeIcon(Class baseClass, String gifFile)
|
||||
{
|
||||
|
@ -252,6 +304,8 @@ public abstract class LookAndFeel
|
|||
* ActionMap.
|
||||
*
|
||||
* @param keys the Object array describing the InputMap as above
|
||||
*
|
||||
* @return A new input map.
|
||||
*/
|
||||
public static InputMap makeInputMap(Object[] keys)
|
||||
{
|
||||
|
@ -269,7 +323,8 @@ public abstract class LookAndFeel
|
|||
* @param keyBindingList the array of KeyStroke-Action pairs
|
||||
* @return a JTextComponent.KeyBinding array
|
||||
*/
|
||||
public static JTextComponent.KeyBinding[] makeKeyBindings(Object[] keyBindingList)
|
||||
public static JTextComponent.KeyBinding[] makeKeyBindings(
|
||||
Object[] keyBindingList)
|
||||
{
|
||||
JTextComponent.KeyBinding[] retBindings =
|
||||
new JTextComponent.KeyBinding[keyBindingList.length / 2];
|
||||
|
@ -280,15 +335,16 @@ public abstract class LookAndFeel
|
|||
stroke = (KeyStroke)keyBindingList[i];
|
||||
else
|
||||
stroke = KeyStroke.getKeyStroke((String)keyBindingList[i]);
|
||||
retBindings[i/2] = new JTextComponent.KeyBinding(stroke, (String)keyBindingList[i+1]);
|
||||
retBindings[i/2] = new JTextComponent.KeyBinding(stroke,
|
||||
(String) keyBindingList[i+1]);
|
||||
}
|
||||
return retBindings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked when the user attempts an invalid operation. The default implement
|
||||
* just beeps. Subclasses that wish to change this need to override this
|
||||
* method.
|
||||
* Invoked when the user attempts an invalid operation. The default
|
||||
* implementation just beeps. Subclasses that wish to change this need to
|
||||
* override this method.
|
||||
*
|
||||
* @param component the component the error occured in
|
||||
*/
|
||||
|
@ -320,10 +376,58 @@ public abstract class LookAndFeel
|
|||
/**
|
||||
* Convenience method for un-installing a component's default border on the
|
||||
* specified component if the border is currently an instance of UIResource.
|
||||
*
|
||||
* @param c the component (<code>null</code> not permitted).
|
||||
*/
|
||||
public static void uninstallBorder(JComponent c)
|
||||
{
|
||||
if (c.getBorder() instanceof UIResource)
|
||||
c.setBorder(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* This methods installs a UI property if it hasn't already been set by an
|
||||
* application. This method is used by UI delegates that install a default
|
||||
* value for a property with a primitive type but do not want to override
|
||||
* a value that has been set by an application.
|
||||
*
|
||||
* The supported properties depend on the actual type of the component and
|
||||
* are listed in the table below. The supported properties are of course
|
||||
* inherited to subclasses.
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>Type</th><th>Supported properties</th></tr>
|
||||
* <tr><td><code>JComponent</code></td>
|
||||
* <td><code>opaque, autoscrolls</code></td></tr>
|
||||
* <tr><td><code>AbstractButton</code></td>
|
||||
* <td><code>borderPainted, rolloverEnabled, iconTextGap,
|
||||
* contentAreaFilled</code></td></tr>
|
||||
* <tr><td><code>JDesktopPane</code></td>
|
||||
* <td><code>dragMode</code></td></tr>
|
||||
* <tr><td><code>JSplitPane</code></td>
|
||||
* <td><code>dividerSize, oneTouchExpandable</code></td></tr>
|
||||
* <tr><td><code>JTable</code></td>
|
||||
* <td><code>rowHeight</code></td></tr>
|
||||
* <tr><td><code>JTree</code></td>
|
||||
* <td><code>rowHeight, scrollsOnExpand, showsRootHandles</code></td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @param c the component to install the property to
|
||||
* @param propertyName the name of the property
|
||||
* @param value the value of the property
|
||||
*
|
||||
* @throws IllegalArgumentException if the specified property cannot be set
|
||||
* by this method
|
||||
* @throws ClassCastException if the property value does not match the
|
||||
* property type
|
||||
* @throws NullPointerException if <code>c</code> or
|
||||
* <code>propertyValue</code> is <code>null</code>
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
public static void installProperty(JComponent c, String propertyName,
|
||||
Object value)
|
||||
{
|
||||
c.setUIProperty(propertyName, value);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue