/[classpath]/classpath/javax/swing/UIManager.java
ViewVC logotype

Diff of /classpath/javax/swing/UIManager.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.24 by trebligd, Tue Aug 23 14:55:27 2005 UTC revision 1.25 by trebligd, Tue Aug 23 15:11:13 2005 UTC
# Line 51  import javax.swing.event.SwingPropertyCh Line 51  import javax.swing.event.SwingPropertyCh
51  import javax.swing.plaf.ComponentUI;  import javax.swing.plaf.ComponentUI;
52  import javax.swing.plaf.metal.MetalLookAndFeel;  import javax.swing.plaf.metal.MetalLookAndFeel;
53    
54    /**
55     * Manages the current {@link LookAndFeel} and any auxiliary {@link LookAndFeel}
56     * instances.
57     */
58  public class UIManager implements Serializable  public class UIManager implements Serializable
59  {  {
60      /**
61       * Represents the basic information about a {@link LookAndFeel} (LAF), so
62       * that a list of installed LAFs can be presented without actually loading
63       * the LAF class(es).
64       */
65    public static class LookAndFeelInfo    public static class LookAndFeelInfo
66    {    {
67      String name, clazz;      String name, clazz;
68                    
69        /**
70         * Creates a new instance.
71         *
72         * @param name  the look and feel name.
73         * @param clazz  the look and feel class name.
74         */
75      public LookAndFeelInfo(String name,      public LookAndFeelInfo(String name,
76                             String clazz)                             String clazz)
77      {      {
# Line 64  public class UIManager implements Serial Line 79  public class UIManager implements Serial
79        this.clazz = clazz;        this.clazz = clazz;
80      }      }
81    
82        /**
83         * Returns the name of the look and feel.
84         *
85         * @return The name of the look and feel.
86         */
87      public String getName()      public String getName()
88      {      {
89        return name;        return name;
90      }      }
91            
92        /**
93         * Returns the fully qualified class name for the {@link LookAndFeel}.
94         *
95         * @return The fully qualified class name for the {@link LookAndFeel}.
96         */
97      public String getClassName()      public String getClassName()
98      {      {
99        return clazz;        return clazz;
# Line 94  public class UIManager implements Serial Line 119  public class UIManager implements Serial
119    
120    private static final long serialVersionUID = -5547433830339189365L;    private static final long serialVersionUID = -5547433830339189365L;
121    
122      /** The installed look and feel(s). */
123    static LookAndFeelInfo [] installed = {    static LookAndFeelInfo [] installed = {
124      new LookAndFeelInfo ("Metal", "javax.swing.plaf.metal.MetalLookAndFeel")      new LookAndFeelInfo("Metal", "javax.swing.plaf.metal.MetalLookAndFeel")
125    };    };
126    
127      /** The installed auxiliary look and feels. */
128    static LookAndFeel[] aux_installed;    static LookAndFeel[] aux_installed;
129        
130      /** The current look and feel. */
131    static LookAndFeel currentLookAndFeel;    static LookAndFeel currentLookAndFeel;
132        
133    static UIDefaults currentUIDefaults;    static UIDefaults currentUIDefaults;
# Line 131  public class UIManager implements Serial Line 159  public class UIManager implements Serial
159    
160    }    }
161        
162      /**
163       * Creates a new instance of the <code>UIManager</code>.  There is no need
164       * to construct an instance of this class, since all methods are static.
165       */
166    public UIManager()    public UIManager()
167    {    {
168      // Do nothing here.      // Do nothing here.
# Line 170  public class UIManager implements Serial Line 202  public class UIManager implements Serial
202    }    }
203    
204    /**    /**
205     * Add a LookAndFeel to the list of auxiliary look and feels.     * Add a {@link LookAndFeel} to the list of auxiliary look and feels.
206       *
207       * @param laf  the auxiliary look and feel (<code>null</code> not permitted).
208       *
209       * @throws NullPointerException if <code>laf</code> is <code>null</code>.
210       *
211       * @see #getAuxiliaryLookAndFeels()
212     */     */
213    public static void addAuxiliaryLookAndFeel (LookAndFeel l)    public static void addAuxiliaryLookAndFeel (LookAndFeel l)
214    {    {
# Line 187  public class UIManager implements Serial Line 225  public class UIManager implements Serial
225      aux_installed[aux_installed.length-1] = l;      aux_installed[aux_installed.length-1] = l;
226    }    }
227            
228      /**
229       * Removes a {@link LookAndFeel} (LAF) from the list of auxiliary LAFs.
230       *
231       * @param laf  the LAF to remove.
232       *
233       * @return <code>true</code> if the LAF was removed, and <code>false</code>
234       *         otherwise.
235       */
236    public static boolean removeAuxiliaryLookAndFeel(LookAndFeel laf)    public static boolean removeAuxiliaryLookAndFeel(LookAndFeel laf)
237    {    {
238      if (aux_installed == null)      if (aux_installed == null)
# Line 206  public class UIManager implements Serial Line 252  public class UIManager implements Serial
252      return false;      return false;
253    }    }
254    
255      /**
256       * Returns an array (possibly <code>null</code>) containing the auxiliary
257       * {@link LookAndFeel}s that are in use.  These are used by the
258       * {@link javax.swing.plaf.multi.MultiLookAndFeel} class.
259       *
260       * @return The auxiliary look and feels (possibly <code>null</code>).
261       *
262       * @see #addAuxiliaryLookAndFeel(LookAndFeel)
263       */
264    public static  LookAndFeel[] getAuxiliaryLookAndFeels()    public static  LookAndFeel[] getAuxiliaryLookAndFeels()
265    {    {
266      return aux_installed;      return aux_installed;
267    }    }
268    
269      /**
270       * Returns an object from the {@link UIDefaults} table for the current
271       * {@link LookAndFeel}.
272       *
273       * @param key  the key.
274       *
275       * @return The object.
276       */
277    public static Object get(Object key)    public static Object get(Object key)
278    {    {
279      return getLookAndFeelDefaults().get(key);      return getLookAndFeelDefaults().get(key);
280    }    }
281    
282      /**
283       * Returns an object from the {@link UIDefaults} table for the current
284       * {@link LookAndFeel}.
285       *
286       * @param key  the key.
287       *
288       * @return The object.
289       */
290    public static Object get(Object key, Locale locale)    public static Object get(Object key, Locale locale)
291    {    {
292      return getLookAndFeelDefaults().get(key ,locale);      return getLookAndFeelDefaults().get(key ,locale);
# Line 280  public class UIManager implements Serial Line 351  public class UIManager implements Serial
351    }    }
352    
353    /**    /**
354     * this string can be passed to Class.forName()     * The fully qualified class name of the cross platform (Metal) look and feel.
355       * This string can be passed to Class.forName()
356       *
357       * @return <code>"javax.swing.plaf.metal.MetalLookAndFeel"</code>
358     */     */
359    public static String getCrossPlatformLookAndFeelClassName()    public static String getCrossPlatformLookAndFeelClassName()
360    {        {    
# Line 289  public class UIManager implements Serial Line 363  public class UIManager implements Serial
363    
364    /**    /**
365     * Returns the default values for this look and feel.     * Returns the default values for this look and feel.
366       *
367       * @return The {@link UIDefaults} for the current {@link LookAndFeel}.
368     */     */
369    public static UIDefaults getDefaults()    public static UIDefaults getDefaults()
370    {    {
# Line 369  public class UIManager implements Serial Line 445  public class UIManager implements Serial
445      return getLookAndFeelDefaults().getInsets(key, locale);      return getLookAndFeelDefaults().getInsets(key, locale);
446    }    }
447    
448      /**
449       * Returns an array containing information about the {@link LookAndFeel}s
450       * that are installed.
451       *
452       * @return A list of the look and feels that are available (installed).
453       */
454    public static LookAndFeelInfo[] getInstalledLookAndFeels()    public static LookAndFeelInfo[] getInstalledLookAndFeels()
455    {    {
456      return installed;      return installed;
# Line 390  public class UIManager implements Serial Line 472  public class UIManager implements Serial
472      return x.intValue();      return x.intValue();
473    }    }
474    
475      /**
476       * Returns the current look and feel (which may be <code>null</code>).
477       *
478       * @return The current look and feel.
479       *
480       * @see #setLookAndFeel(LookAndFeel)
481       */
482    public static LookAndFeel getLookAndFeel()    public static LookAndFeel getLookAndFeel()
483    {    {
484      return currentLookAndFeel;      return currentLookAndFeel;
# Line 398  public class UIManager implements Serial Line 487  public class UIManager implements Serial
487    /**    /**
488     * Returns the <code>UIDefaults</code> table of the currently active     * Returns the <code>UIDefaults</code> table of the currently active
489     * look and feel.     * look and feel.
490       *
491       * @return The {@link UIDefaults} for the current {@link LookAndFeel}.
492     */     */
493    public static UIDefaults getLookAndFeelDefaults()    public static UIDefaults getLookAndFeelDefaults()
494    {    {
# Line 421  public class UIManager implements Serial Line 512  public class UIManager implements Serial
512    }    }
513        
514    /**    /**
515     * Returns the name of the LookAndFeel class that implements the     * Returns the name of the {@link LookAndFeel} class that implements the
516     * native systems look and feel if there is one, otherwise the name     * native systems look and feel if there is one, otherwise the name
517     * of the default cross platform LookAndFeel class.     * of the default cross platform LookAndFeel class.
518       *
519       * @return The fully qualified class name for the system look and feel.
520       *
521       * @see #getCrossPlatformLookAndFeelClassName()
522     */     */
523    public static String getSystemLookAndFeelClassName()    public static String getSystemLookAndFeelClassName()
524    {    {
# Line 431  public class UIManager implements Serial Line 526  public class UIManager implements Serial
526    }    }
527    
528    /**    /**
529     * Returns the Look and Feel object that renders the target component.     * Returns UI delegate from the current {@link LookAndFeel} that renders the
530       * target component.
531       *
532       * @param target  the target component.
533     */     */
534    public static ComponentUI getUI(JComponent target)    public static ComponentUI getUI(JComponent target)
535    {    {
# Line 440  public class UIManager implements Serial Line 538  public class UIManager implements Serial
538    
539    /**    /**
540     * Creates a new look and feel and adds it to the current array.     * Creates a new look and feel and adds it to the current array.
541       *
542       * @param name  the look and feel name.
543       * @param className  the fully qualified name of the class that implements the
544       *                   look and feel.
545     */     */
546    public static void installLookAndFeel(String name, String className)    public static void installLookAndFeel(String name, String className)
547    {    {
# Line 451  public class UIManager implements Serial Line 553  public class UIManager implements Serial
553     */     */
554    public static void installLookAndFeel(LookAndFeelInfo info)    public static void installLookAndFeel(LookAndFeelInfo info)
555    {    {
556        // FIXME: not yet implemented
557    }    }
558    
559    /**    /**
# Line 466  public class UIManager implements Serial Line 569  public class UIManager implements Serial
569     */     */
570    public static void setInstalledLookAndFeels(UIManager.LookAndFeelInfo[] infos)    public static void setInstalledLookAndFeels(UIManager.LookAndFeelInfo[] infos)
571    {    {
572        // FIXME: not yet implemented.
573    }    }
574        
575    /**    /**
576     * Set the current default look.     * Sets the current {@link LookAndFeel}.
577       *
578       * @param newLookAndFeel  the new look and feel (<code>null</code> permitted).
579       *
580       * @throws UnsupportedLookAndFeelException if the look and feel is not
581       *         supported on the current platform.
582       *
583       * @see LookAndFeel#isSupportedLookAndFeel()
584     */     */
585    public static void setLookAndFeel(LookAndFeel newLookAndFeel)    public static void setLookAndFeel(LookAndFeel newLookAndFeel)
586      throws UnsupportedLookAndFeelException      throws UnsupportedLookAndFeelException
# Line 499  public class UIManager implements Serial Line 610  public class UIManager implements Serial
610    
611    /**    /**
612     * Set the current default look and feel using a class name.     * Set the current default look and feel using a class name.
613       *
614       * @param className  the look and feel class name.
615       *
616       * @throws UnsupportedLookAndFeelException if the look and feel is not
617       *         supported on the current platform.
618       *
619       * @see LookAndFeel#isSupportedLookAndFeel()
620     */     */
621    public static void setLookAndFeel (String className)    public static void setLookAndFeel(String className)
622      throws ClassNotFoundException, InstantiationException, IllegalAccessException,      throws ClassNotFoundException, InstantiationException, IllegalAccessException,
623      UnsupportedLookAndFeelException      UnsupportedLookAndFeelException
624    {    {

Legend:
Removed from v.1.24  
changed lines
  Added in v.1.25

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26