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]

[GUI] Patch: javax.swing.text - more improvements


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

Hi list,


I just commited the attached patch to improve javax.swing.text just 
more.


Michael


2004-06-16  Michael Koch  <konqueror@gmx.de>

	* javax/swing/text/AbstractDocument.java
	(insertString): Throws BadLocationException.
	* javax/swing/text/Document.java
	(insertString): Likewise.
	* javax/swing/text/JTextComponent.java:
	Javadocs and comments cleaned up.

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

iD8DBQFA0CAUWSOgCCdjSDsRAn2cAJ4r0Defc9lwpYH7YA24S6pVwC6/jACaAwk0
Y4LIhwpRedPrOJAZyni/9ms=
=HTRZ
-----END PGP SIGNATURE-----
Index: javax/swing/text/AbstractDocument.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/text/AbstractDocument.java,v
retrieving revision 1.3.8.3
diff -u -b -B -r1.3.8.3 AbstractDocument.java
--- javax/swing/text/AbstractDocument.java	16 Jun 2004 10:06:47 -0000	1.3.8.3
+++ javax/swing/text/AbstractDocument.java	16 Jun 2004 10:21:57 -0000
@@ -452,16 +452,10 @@
   }
 
   public void insertString(int offs, String str, AttributeSet a)
-  {
-    try
+    throws BadLocationException
       {
 	content.insertString(offs, str);
       }
-    catch (Exception e)
-      {
-	System.err.println("FAILED TO INSERT-STRING: " + e + ", at:" + offs);
-      }
-  }
 
   protected void insertUpdate(DefaultDocumentEvent chng, AttributeSet attr)
   {
Index: javax/swing/text/Document.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/text/Document.java,v
retrieving revision 1.4.8.1
diff -u -b -B -r1.4.8.1 Document.java
--- javax/swing/text/Document.java	11 Jun 2004 08:05:18 -0000	1.4.8.1
+++ javax/swing/text/Document.java	16 Jun 2004 10:21:57 -0000
@@ -68,7 +68,8 @@
 
   void getText(int offset, int length, Segment txt);
 
-  void insertString(int offset, String str, AttributeSet a);
+  void insertString(int offset, String str, AttributeSet a)
+    throws BadLocationException;
 
   void putProperty(Object key, Object value);
 
Index: javax/swing/text/JTextComponent.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/text/JTextComponent.java,v
retrieving revision 1.4.2.5
diff -u -b -B -r1.4.2.5 JTextComponent.java
--- javax/swing/text/JTextComponent.java	16 Jun 2004 08:20:15 -0000	1.4.2.5
+++ javax/swing/text/JTextComponent.java	16 Jun 2004 10:21:57 -0000
@@ -71,7 +71,7 @@
 //      implements AccessibleText, CaretListener, DocumentListener,
 //                 AccessibleAction, AccessibleEditableText
 //    {
-//    } // class AccessibleJTextComponent
+//    }
 
   /**
    * AccessibleJTextComponent
@@ -96,39 +96,39 @@
 
     /**
      * getCaretPosition
-     * @returns int
+     * @return int
      */
     public int getCaretPosition()
     {
       return 0; // TODO
-    } // getCaretPosition()
+    }
 
     /**
      * getSelectedText
-     * @returns String
+     * @return String
      */
     public String getSelectedText()
     {
       return null; // TODO
-    } // getSelectedText()
+    }
 
     /**
      * getSelectionStart
-     * @returns int
+     * @return int
      */
     public int getSelectionStart()
     {
       return 0; // TODO
-    } // getSelectionStart()
+    }
 
     /**
      * getSelectionEnd
-     * @returns int
+     * @return int
      */
     public int getSelectionEnd()
     {
       return 0; // TODO
-    } // getSelectionEnd()
+    }
 
     /**
      * caretUpdate
@@ -137,34 +137,34 @@
     public void caretUpdate(CaretEvent value0)
     {
       // TODO
-    } // caretUpdate()
+    }
 
     /**
      * getAccessibleStateSet
-     * @returns AccessibleStateSet
+     * @return AccessibleStateSet
      */
     public AccessibleStateSet getAccessibleStateSet()
     {
       return null; // TODO
-    } // getAccessibleStateSet()
+    }
 
     /**
      * getAccessibleRole
-     * @returns AccessibleRole
+     * @return AccessibleRole
      */
     public AccessibleRole getAccessibleRole()
     {
       return null; // TODO
-    } // getAccessibleRole()
+    }
 
     /**
      * getAccessibleText
-     * @returns AccessibleText
+     * @return AccessibleText
      */
     public AccessibleText getAccessibleText()
     {
       return null; // TODO
-    } // getAccessibleText()
+    }
 
     /**
      * insertUpdate
@@ -173,7 +173,7 @@
     public void insertUpdate(DocumentEvent value0)
     {
       // TODO
-    } // insertUpdate()
+    }
 
     /**
      * removeUpdate
@@ -182,7 +182,7 @@
     public void removeUpdate(DocumentEvent value0)
     {
       // TODO
-    } // removeUpdate()
+    }
 
     /**
      * changedUpdate
@@ -191,89 +191,89 @@
     public void changedUpdate(DocumentEvent value0)
     {
       // TODO
-    } // changedUpdate()
+    }
 
     /**
      * getIndexAtPoint
      * @param value0 TODO
-     * @returns int
+     * @return int
      */
     public int getIndexAtPoint(Point value0)
     {
       return 0; // TODO
-    } // getIndexAtPoint()
+    }
 
     /**
      * getRootEditorRect
-     * @returns Rectangle
+     * @return Rectangle
      */
     Rectangle getRootEditorRect()
     {
-      return null; // TODO
-    } // getRootEditorRect()
+      return null;
+    }
 
     /**
      * getCharacterBounds
      * @param value0 TODO
-     * @returns Rectangle
+     * @return Rectangle
      */
     public Rectangle getCharacterBounds(int value0)
     {
       return null; // TODO
-    } // getCharacterBounds()
+    }
 
     /**
      * getCharCount
-     * @returns int
+     * @return int
      */
     public int getCharCount()
     {
       return 0; // TODO
-    } // getCharCount()
+    }
 
     /**
      * getCharacterAttribute
      * @param value0 TODO
-     * @returns AttributeSet
+     * @return AttributeSet
      */
     public AttributeSet getCharacterAttribute(int value0)
     {
       return null; // TODO
-    } // getCharacterAttribute()
+    }
 
     /**
      * getAtIndex
      * @param value0 TODO
      * @param value1 TODO
-     * @returns String
+     * @return String
      */
     public String getAtIndex(int value0, int value1)
     {
       return null; // TODO
-    } // getAtIndex()
+    }
 
     /**
      * getAfterIndex
      * @param value0 TODO
      * @param value1 TODO
-     * @returns String
+     * @return String
      */
     public String getAfterIndex(int value0, int value1)
     {
       return null; // TODO
-    } // getAfterIndex()
+    }
 
     /**
      * getBeforeIndex
      * @param value0 TODO
      * @param value1 TODO
-     * @returns String
+     * @return String
      */
     public String getBeforeIndex(int value0, int value1)
     {
       return null; // TODO
-    } // getBeforeIndex()
-  } // AccessibleJTextComponent
+    }
+  }
 
   public static class KeyBinding
   {
@@ -285,7 +285,7 @@
       this.key = key;
       this.actionName = actionName;
     }
-  } // class KeyBinding
+  }
 
   private static final long serialVersionUID = -8796518220218978795L;
   
@@ -317,21 +317,28 @@
     return doc;
   }
 
+  /**
+   * Verify that key is a legal value for the horizontalAlignment properties.
+   */
   protected int checkHorizontalKey(int key, String message)
   {
-    //    Verify that key is a legal value for the horizontalAlignment properties. 
     return 0;
   }
 
+  /**
+   * Verify that key is a legal value for the verticalAlignment
+   * or verticalTextPosition properties.
+   */
   protected int checkVerticalKey(int key, String message)
   {
-    //      Verify that key is a legal value for the verticalAlignment or verticalTextPosition properties.  
     return 0;
   }
 
+  /**
+   * Get the AccessibleContext of this object
+   */
   public AccessibleContext getAccessibleContext()
   {
-    //          Get the AccessibleContext of this object 
     return null;
   }
 
@@ -340,21 +347,28 @@
     return null;
   }
 
+  /**
+   * Return the keycode that indicates a mnemonic key.
+   */
   public int getDisplayedMnemonic()
   {
-    //          Return the keycode that indicates a mnemonic key.   
     return 0;
   }
 
+  /**
+   * Returns the alignment of the label's contents along the X axis.
+   */
   public int getHorizontalAlignment()
   {
-    //          Returns the alignment of the label's contents along the X axis.   
     return 0;
   }
 
+  /**
+   * Returns the horizontal position of the label's text,
+   * relative to its image.
+   */
   public int getHorizontalTextPosition()
   {
-    //          Returns the horizontal position of the label's text, relative to its image.    
     return 0;
   }
 
@@ -368,9 +382,11 @@
     return icon_gap;
   }
 
+  /**
+   * Get the component this is labelling.
+   */
   Component getLabelFor()
   {
-    //          Get the component this is labelling.  
     return null;
   }
 
@@ -382,94 +398,133 @@
 
   public void setText(String text)
   {
+    try
+      {
     getDocument().remove(0, doc.getLength());
     getDocument().insertString(0, text, null);
   }
+    catch (BadLocationException e)
+      {
+      }
+  }
 
   public String getText()
   {
     return getDocument().getText(0, getDocument().getLength());
   }
 
+  /**
+   * Returns a string that specifies the name of the l&amp;f class
+   * that renders this component.
+   *
+   * @return the string "TextComponentUI"
+   */
   public String getUIClassID()
   {
-    //          Returns a string that specifies the name of the l&f class that renders this component.  
     return "TextComponentUI";
   }
 
+  /**
+   * Returns the alignment of the label's contents along the Y axis.
+   */
   public int getVerticalAlignment()
   {
-    //          Returns the alignment of the label's contents along the Y axis. 
     return 0;
   }
 
+  /**
+   * Returns the vertical position of the label's text, relative to its image.
+   */
   public int getVerticalTextPosition()
   {
-    //          Returns the vertical position of the label's text, relative to its image. 
     return 0;
   }
 
+  /**
+   * This is overriden to return false if the current Icon's Image is not equal to the passed in Image img.
+   */
   public boolean imageUpdate(Image img, int infoflags, int x, int y, int w,
                              int h)
   {
-    //          This is overriden to return false if the current Icon's Image is not equal to the passed in Image img. 
     return (img == icon);
   }
 
+  /**
+   * Returns a string representation of this JTextComponent.
+   */
   protected String paramString()
   {
-    //          Returns a string representation of this JTextComponent.  
     return "JTextComponent";
   }
 
+  /**
+   * Set the icon to be displayed if this JTextComponent is "disabled" (JTextComponent.setEnabled(false)).
+   */
   void setDisabledIcon(Icon disabledIcon)
   {
-    //          Set the icon to be displayed if this JTextComponent is "disabled" (JTextComponent.setEnabled(false)).  
   }
 
+  /**
+   * Specifies the displayedMnemonic as a char value.
+   */
   void setDisplayedMnemonic(char aChar)
   {
-    //          Specifies the displayedMnemonic as a char value.  
   }
 
+  /**
+   * Specify a keycode that indicates a mnemonic key.
+   */
   void setDisplayedMnemonic(int key)
   {
-    //          Specify a keycode that indicates a mnemonic key.  
   }
 
+  /**
+   * Sets the alignment of the label's contents along the X axis.
+   */
   void setHorizontalAlignment(int alignment)
   {
-    //          Sets the alignment of the label's contents along the X axis.  
   }
 
+  /**
+   * Sets the horizontal position of the label's text, relative to its image.
+   */
   void setHorizontalTextPosition(int textPosition)
   {
-    //          Sets the horizontal position of the label's text, relative to its image.  
   }
 
+  /**
+   * Defines the icon this component will display.
+   */
   void setIcon(Icon icon)
   {
-    //          Defines the icon this component will display.  
   }
 
+  /**
+   * If both the icon and text properties are set, this property defines the space between them.
+   */
   public void setIconTextGap(int iconTextGap)
   {
-    //          If both the icon and text properties are set, this property defines the space between them.  
   }
 
+  /**
+   * Set the component this is labelling.
+   */
   public void setLabelFor(Component c)
   {
-    //          Set the component this is labelling.  
   }
 
+  /**
+   * Sets the alignment of the label's contents along the Y axis.
+   */
   public void setVerticalAlignment(int alignment)
   {
-    //          Sets the alignment of the label's contents along the Y axis.  
   }
 
+  /**
+   * Sets the vertical position of the label's text, relative to its image.
+   */
   public void setVerticalTextPosition(int textPosition)
   {
-    //          Sets the vertical position of the label's text, relative to its image.  
   }
 
   public TextUI getUI()

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