This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: javax.swing


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi list,

I just commited the attached patch to implement some missing methods 
in javax.swing.UIManager and to make javax.swing.SpinnerNumberModel 
implement java.io.Serializable.


Michael


2004-09-11  Michael Koch  <konqueror@gmx.de>

	* javax/swing/SpinnerNumberModel.java
	(SpinnerNumberModel): Implements java.io.Serializable.
	(serialVersionUID): New field.
	(SpinnerNumberModel): Added missing @throws tags to javadocs.
	* javax/swing/UIManager.java
	(get): New method.
	(getBoolean): Likewise.
	(getBorder): Likewise.
	(getColor): Likewise.
	(getDimension): Likewise.
	(getFont): Likewise.
	(getIcon): Likewise.
	(getInsets): Likewise.
	(getInt): Likewise.
	(getString): Likewise.


- -- 
Homepage: http://www.worldforge.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFBQr8uWSOgCCdjSDsRAlplAKCaACJ7XpV8zQgtTUW8+Gy5Kmr+vwCeOyrm
vai3ZADReE2Cfd47I0unZMc=
=lQZN
-----END PGP SIGNATURE-----
Index: javax/swing/SpinnerNumberModel.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/SpinnerNumberModel.java,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 SpinnerNumberModel.java
--- javax/swing/SpinnerNumberModel.java	25 Aug 2004 21:49:47 -0000	1.1.2.2
+++ javax/swing/SpinnerNumberModel.java	11 Sep 2004 08:50:42 -0000
@@ -37,6 +37,8 @@
 
 package javax.swing;
 
+import java.io.Serializable;
+
 /**
  * SpinnerNumberModel
  *
@@ -44,7 +46,10 @@
  * @version 1.0
  */
 public class SpinnerNumberModel extends AbstractSpinnerModel
+  implements Serializable
 {
+  private static final long serialVersionUID = 7279176385485777821L;
+
   /** DOCUMENT ME! */
   private Number value;
 
@@ -73,6 +78,8 @@
    * @param minimum the minimum value
    * @param maximum the maximum value
    * @param stepSize the step size
+   * @throws IllegalArgumentException if minimum &lt;= value &lt;= maximum does not
+   *                                  hold
    */
   public SpinnerNumberModel(double value, double minimum, double maximum,
                             double stepSize)
@@ -88,6 +95,8 @@
    * @param minimum the minimum value
    * @param maximum the maximum value
    * @param stepSize the step size
+   * @throws IllegalArgumentException if minimum &lt;= value &lt;= maximum does not
+   *                                  hold
    */
   public SpinnerNumberModel(int value, int minimum, int maximum, int stepSize)
   {
Index: javax/swing/UIManager.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/UIManager.java,v
retrieving revision 1.6.8.4
diff -u -r1.6.8.4 UIManager.java
--- javax/swing/UIManager.java	30 Jul 2004 21:34:34 -0000	1.6.8.4
+++ javax/swing/UIManager.java	11 Sep 2004 08:50:42 -0000
@@ -44,6 +44,7 @@
 import java.awt.Insets;
 import java.beans.PropertyChangeListener;
 import java.io.Serializable;
+import java.util.Locale;
 import javax.swing.border.Border;
 import javax.swing.plaf.ComponentUI;
 import javax.swing.plaf.metal.MetalLookAndFeel;
@@ -158,10 +159,43 @@
   }
 
   public static  LookAndFeel[] getAuxiliaryLookAndFeels()
-  {	return aux_installed;    }
+  {
+    return aux_installed;
+  }
 
   public static  Object get(Object key)
-  {	return getLookAndFeel().getDefaults().get(key);    }
+  {
+    return getLookAndFeel().getDefaults().get(key);
+  }
+
+  public static  Object get(Object key, Locale locale)
+  {
+    return getLookAndFeel().getDefaults().get(key ,locale);
+  }
+
+  /**
+   * Returns a boolean value from the defaults table,
+   * <code>false</code> if key is not present.
+   *
+   * @since 1.4
+   */
+  public static boolean getBoolean(Object key)
+  {
+    Boolean value = (Boolean) getLookAndFeel().getDefaults().get(key);
+    return value != null ? value.booleanValue() : false;
+  }
+  
+  /**
+   * Returns a boolean value from the defaults table,
+   * <code>false</code> if key is not present.
+   *
+   * @since 1.4
+   */
+  public static boolean getBoolean(Object key, Locale locale)
+  {
+    Boolean value = (Boolean) getLookAndFeel().getDefaults().get(key, locale);
+    return value != null ? value.booleanValue() : false;
+  }
     
   /**
    * Returns a border from the defaults table. 
@@ -172,6 +206,16 @@
   }
     
   /**
+   * Returns a border from the defaults table.
+   *
+   * @since 1.4
+   */
+  public static Border getBorder(Object key, Locale locale)
+  {
+    return (Border) getLookAndFeel().getDefaults().get(key, locale);
+  }
+    
+  /**
    * Returns a drawing color from the defaults table. 
    */
   public static  Color getColor(Object key)
@@ -180,6 +224,14 @@
   }
 
   /**
+   * Returns a drawing color from the defaults table. 
+   */
+  public static  Color getColor(Object key, Locale locale)
+  {
+    return (Color) getLookAndFeel().getDefaults().get(key);
+  }
+
+  /**
    * this string can be passed to Class.forName()
    */
   public static  String getCrossPlatformLookAndFeelClassName()
@@ -204,6 +256,14 @@
   }
 
   /**
+   * Returns a dimension from the defaults table. 
+   */
+  public static Dimension getDimension(Object key, Locale locale)
+  {
+    return (Dimension) getLookAndFeel().getDefaults().get(key, locale);
+  }
+
+  /**
    * Retrieves a font from the defaults table of the current
    * LookAndFeel.
    *
@@ -217,6 +277,19 @@
   }
 
   /**
+   * Retrieves a font from the defaults table of the current
+   * LookAndFeel.
+   *
+   * @param key an Object that specifies the font. Typically,
+   *        this is a String such as
+   *        <code>TitledBorder.font</code>.
+   */
+  public static Font getFont(Object key, Locale locale)
+  {
+    return (Font) getLookAndFeel().getDefaults().get(key ,locale);
+  }
+
+  /**
    * Returns an Icon from the defaults table.
    */
   public static Icon getIcon(Object key)
@@ -225,6 +298,14 @@
   }
   
   /**
+   * Returns an Icon from the defaults table.
+   */
+  public static Icon getIcon(Object key, Locale locale)
+  {
+    return (Icon) getLookAndFeel().getDefaults().get(key, locale);
+  }
+  
+  /**
    * Returns an Insets object from the defaults table.
    */
   public static Insets getInsets(Object key)
@@ -232,6 +313,14 @@
     return (Insets) getLookAndFeel().getDefaults().getInsets(key);
   }
 
+  /**
+   * Returns an Insets object from the defaults table.
+   */
+  public static Insets getInsets(Object key, Locale locale)
+  {
+    return (Insets) getLookAndFeel().getDefaults().getInsets(key, locale);
+  }
+
   public static LookAndFeelInfo[] getInstalledLookAndFeels()
   {
     return installed;
@@ -245,6 +334,14 @@
     return x.intValue();
   }
 
+  public static int getInt(Object key, Locale locale)
+  {
+    Integer x = (Integer) getLookAndFeel().getDefaults().get(key, locale);
+    if (x == null)
+      return 0;
+    return x.intValue();
+  }
+
   public static LookAndFeel getLookAndFeel()
   {
     return look_and_feel;
@@ -268,6 +365,14 @@
   }
   
   /**
+   * Returns a string from the defaults table.
+   */
+  public static String getString(Object key, Locale locale)
+  {
+    return (String) getLookAndFeel().getDefaults().get(key, locale);
+  }
+  
+  /**
    * Returns the name of the LookAndFeel class that implements the
    * native systems look and feel if there is one, otherwise the name
    * of the default cross platform LookAndFeel class.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]