Java Doc for BasicLookAndFeel.java in  » 6.0-JDK-Core » swing » javax » swing » plaf » basic » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » swing » javax.swing.plaf.basic 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   javax.swing.LookAndFeel
      javax.swing.plaf.basic.BasicLookAndFeel

All known Subclasses:   javax.swing.plaf.synth.SynthLookAndFeel,  javax.swing.plaf.metal.MetalLookAndFeel,
BasicLookAndFeel
abstract public class BasicLookAndFeel extends LookAndFeel implements Serializable(Code)
A base class to use in creating a look and feel for Swing.

Each of the ComponentUI s provided by BasicLookAndFeel derives its behavior from the defaults table. Unless otherwise noted each of the ComponentUI implementations in this package document the set of defaults they use. Unless otherwise noted the defaults are installed at the time installUI is invoked, and follow the recommendations outlined in LookAndFeel for installing defaults.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder .
version:
   1.283 05/09/07
author:
   unattributed


Inner Class :class AWTEventHelper implements AWTEventListener,PrivilegedAction

Field Summary
 AWTEventHelperinvocator
    
static  booleanneedsEventHelper
     Whether or not the developer has created a JPopupMenu.


Method Summary
protected  ActioncreateAudioAction(Object key)
     Creates and returns an Action used to play a sound.

If key is non-null , an Action is created using the value from the defaults with key key .

protected  ActionMapgetAudioActionMap()
     Returns an ActionMap containing the audio actions for this look and feel.

The returned ActionMap contains Actions that embody the ability to render an auditory cue.

public  UIDefaultsgetDefaults()
     Returns the look and feel defaults.
static  ObjectgetUIOfType(ComponentUI ui, Class klass)
     Returns the ui that is of type klass, or null if one can not be found.
protected  voidinitClassDefaults(UIDefaults table)
     Populates table with mappings from uiClassID to the fully qualified name of the ui class.
protected  voidinitComponentDefaults(UIDefaults table)
     Populates table with the defaults for the basic look and feel.
protected  voidinitSystemColorDefaults(UIDefaults table)
     Populates table with system colors.
public  voidinitialize()
    
 voidinstallAWTEventListener()
    
static  voidinstallAudioActionMap(ActionMap map)
     Sets the parent of the passed in ActionMap to be the audio action map.
protected  voidloadSystemColors(UIDefaults table, String[] systemColors, boolean useNative)
     Populates table with the name-color pairs in systemColors .
protected  voidplaySound(Action audioAction)
     If necessary, invokes actionPerformed on audioAction to play a sound.
static  voidplaySound(JComponent c, Object actionKey)
     Helper method to play a named sound.
public  voiduninitialize()
    

Field Detail
invocator
AWTEventHelper invocator(Code)



needsEventHelper
static boolean needsEventHelper(Code)
Whether or not the developer has created a JPopupMenu.





Method Detail
createAudioAction
protected Action createAudioAction(Object key)(Code)
Creates and returns an Action used to play a sound.

If key is non-null , an Action is created using the value from the defaults with key key . The value identifies the sound resource to load when actionPerformed is invoked on the Action . The sound resource is loaded into a byte[] by way of getClass().getResourceAsStream() .
Parameters:
  key - the key identifying the audio action an Action used to play the source, or null if key is null
See Also:   BasicLookAndFeel.playSound(Action)
since:
   1.4




getAudioActionMap
protected ActionMap getAudioActionMap()(Code)
Returns an ActionMap containing the audio actions for this look and feel.

The returned ActionMap contains Actions that embody the ability to render an auditory cue. These auditory cues map onto user and system activities that may be useful for an end user to know about (such as a dialog box appearing).

At the appropriate time, the ComponentUI is responsible for obtaining an Action out of the ActionMap and passing it to playSound.

This method first looks up the ActionMap from the defaults using the key "AuditoryCues.actionMap" .

If the value is non-null , it is returned. If the value of the default "AuditoryCues.actionMap" is null and the value of the default "AuditoryCues.cueList" is non-null , an ActionMapUIResource is created and populated. Population is done by iterating over each of the elements of the "AuditoryCues.cueList" array, and invoking createAudioAction() to create an Action for each element. The resulting Action is placed in the ActionMapUIResource , using the array element as the key. For example, if the "AuditoryCues.cueList" array contains a single-element, "audioKey" , the ActionMapUIResource is created, then populated by way of actionMap.put(cueList[0], createAudioAction(cueList[0])) .

If the value of the default "AuditoryCues.actionMap" is null and the value of the default "AuditoryCues.cueList" is null , an empty ActionMapUIResource is created. an ActionMap containing Actions responsible for playing auditory cues
throws:
  ClassCastException - if the value of thedefault "AuditoryCues.actionMap" is not an ActionMap , or the value of the default "AuditoryCues.cueList" is not an Object[]
See Also:   BasicLookAndFeel.createAudioAction
See Also:   BasicLookAndFeel.playSound(Action)
since:
   1.4




getDefaults
public UIDefaults getDefaults()(Code)
Returns the look and feel defaults. The returned UIDefaults is populated by invoking, in order, initClassDefaults , initSystemColorDefaults and initComponentDefaults .

While this method is public, it should only be invoked by the UIManager when the look and feel is set as the current look and feel and after initialize has been invoked. the look and feel defaults
See Also:   BasicLookAndFeel.initClassDefaults
See Also:   BasicLookAndFeel.initSystemColorDefaults
See Also:   BasicLookAndFeel.initComponentDefaults




getUIOfType
static Object getUIOfType(ComponentUI ui, Class klass)(Code)
Returns the ui that is of type klass, or null if one can not be found.



initClassDefaults
protected void initClassDefaults(UIDefaults table)(Code)
Populates table with mappings from uiClassID to the fully qualified name of the ui class. The value for a particular uiClassID is "javax.swing.plaf.basic.Basic + uiClassID" . For example, the value for the uiClassID TreeUI is "javax.swing.plaf.basic.BasicTreeUI" .
Parameters:
  table - the UIDefaults instance the entries areadded to
throws:
  NullPointerException - if table is null
See Also:   javax.swing.LookAndFeel
See Also:   BasicLookAndFeel.getDefaults



initComponentDefaults
protected void initComponentDefaults(UIDefaults table)(Code)
Populates table with the defaults for the basic look and feel.
Parameters:
  table - the UIDefaults to add the values to
throws:
  NullPointerException - if table is null



initSystemColorDefaults
protected void initSystemColorDefaults(UIDefaults table)(Code)
Populates table with system colors. This creates an array of name-color pairs and invokes loadSystemColors .

The name is a String that corresponds to the name of one of the static SystemColor fields in the SystemColor class. A name-color pair is created for every such SystemColor field.

The color corresponds to a hex String as understood by Color.decode . For example, one of the name-color pairs is "desktop"-"#005C5C" . This corresponds to the SystemColor field desktop , with a color value of new Color(0x005C5C) .

The following shows two of the name-color pairs:

 String[] nameColorPairs = new String[] {
 "desktop", "#005C5C",
 "activeCaption", "#000080" };
 loadSystemColors(table, nameColorPairs, isNativeLookAndFeel());
 
As previously stated, this invokes loadSystemColors with the supplied table and name-color pair array. The last argument to loadSystemColors indicates whether the value of the field in SystemColor should be used. This method passes the value of isNativeLookAndFeel() as the last argument to loadSystemColors .
Parameters:
  table - the UIDefaults object the values are added to
throws:
  NullPointerException - if table is null
See Also:   java.awt.SystemColor
See Also:   BasicLookAndFeel.getDefaults
See Also:   BasicLookAndFeel.loadSystemColors



initialize
public void initialize()(Code)



installAWTEventListener
void installAWTEventListener()(Code)



installAudioActionMap
static void installAudioActionMap(ActionMap map)(Code)
Sets the parent of the passed in ActionMap to be the audio action map.



loadSystemColors
protected void loadSystemColors(UIDefaults table, String[] systemColors, boolean useNative)(Code)
Populates table with the name-color pairs in systemColors . Refer to BasicLookAndFeel.initSystemColorDefaults(UIDefaults) for details on the format of systemColors .

An entry is added to table for each of the name-color pairs in systemColors . The entry key is the name of the name-color pair.

The value of the entry corresponds to the color of the name-color pair. The value of the entry is calculated in one of two ways. With either approach the value is always a ColorUIResource .

If useNative is false , the color is created by using Color.decode to convert the String into a Color . If decode can not convert the String into a Color ( NumberFormatException is thrown) then a ColorUIResource of black is used.

If useNative is true , the color is the value of the field in SystemColor with the same name as the name of the name-color pair. If the field is not valid, a ColorUIResource of black is used.
Parameters:
  table - the UIDefaults object the values are added to
Parameters:
  systemColors - array of name-color pairs as describedin BasicLookAndFeel.initSystemColorDefaults(UIDefaults)
Parameters:
  useNative - whether the color is obtained from SystemColor or Color.decode
throws:
  NullPointerException - if systemColors is null ; or systemColors is not empty, and table is null ; or one of thenames of the name-color pairs is null ; or useNative is false and one of the colors of the name-color pairs is null
throws:
  ArrayIndexOutOfBoundsException - if useNative is false and systemColors.length is odd
See Also:   BasicLookAndFeel.initSystemColorDefaults(javax.swing.UIDefaults)
See Also:   java.awt.SystemColor
See Also:   java.awt.Color.decode(String)




playSound
protected void playSound(Action audioAction)(Code)
If necessary, invokes actionPerformed on audioAction to play a sound. The actionPerformed method is invoked if the value of the "AuditoryCues.playList" default is a non-null Object[] containing a String entry equal to the name of the audioAction .
Parameters:
  audioAction - an Action that knows how to render the audioassociated with the system or user activitythat is occurring; a value of null , isignored
throws:
  ClassCastException - if audioAction is non-null and the value of the default "AuditoryCues.playList" is not an Object[]
since:
   1.4



playSound
static void playSound(JComponent c, Object actionKey)(Code)
Helper method to play a named sound.
Parameters:
  c - JComponent to play the sound for.
Parameters:
  actionKey - Key for the sound.



uninitialize
public void uninitialize()(Code)



Methods inherited from javax.swing.LookAndFeel
public UIDefaults getDefaults()(Code)(Java Doc)
abstract public String getDescription()(Code)(Java Doc)
public static Object getDesktopPropertyValue(String systemPropertyName, Object fallbackValue)(Code)(Java Doc)
public Icon getDisabledIcon(JComponent component, Icon icon)(Code)(Java Doc)
public Icon getDisabledSelectedIcon(JComponent component, Icon icon)(Code)(Java Doc)
abstract public String getID()(Code)(Java Doc)
public LayoutStyle getLayoutStyle()(Code)(Java Doc)
abstract public String getName()(Code)(Java Doc)
public boolean getSupportsWindowDecorations()(Code)(Java Doc)
public void initialize()(Code)(Java Doc)
public static void installBorder(JComponent c, String defaultBorderName)(Code)(Java Doc)
public static void installColors(JComponent c, String defaultBgName, String defaultFgName)(Code)(Java Doc)
public static void installColorsAndFont(JComponent c, String defaultBgName, String defaultFgName, String defaultFontName)(Code)(Java Doc)
public static void installProperty(JComponent c, String propertyName, Object propertyValue)(Code)(Java Doc)
abstract public boolean isNativeLookAndFeel()(Code)(Java Doc)
abstract public boolean isSupportedLookAndFeel()(Code)(Java Doc)
public static void loadKeyBindings(InputMap retMap, Object[] keys)(Code)(Java Doc)
public static ComponentInputMap makeComponentInputMap(JComponent c, Object[] keys)(Code)(Java Doc)
public static Object makeIcon(Class baseClass, String gifFile)(Code)(Java Doc)
public static InputMap makeInputMap(Object[] keys)(Code)(Java Doc)
public static JTextComponent.KeyBinding[] makeKeyBindings(Object[] keyBindingList)(Code)(Java Doc)
public void provideErrorFeedback(Component component)(Code)(Java Doc)
public String toString()(Code)(Java Doc)
public void uninitialize()(Code)(Java Doc)
public static void uninstallBorder(JComponent c)(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.