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


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

Hi list,


I just commited the attached patch to java-gui-branch to fix some more 
swing issues.


Michael


2004-07-20  Michael Koch  <konqueror@gmx.de>

	* javax/swing/JFormattedTextField.java
	(setDocument): Implemented.
	* javax/swing/JRootPane.java:
	Fixed javadocs.
	* javax/swing/JTable.java
	(getDefaultRenderer): New method.
	* javax/swing/JTextField.java
	(setFont): Likewise.
	(getPreferredSize): Likewise.
	* javax/swing/JToggleButton.java
	(getAccessibleContext): Fix javadoc.
	* javax/swing/JTree.java:
	Add some javadocs.
	* javax/swing/JViewport.java:
	Likewise.


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

iD8DBQFA/XXzWSOgCCdjSDsRArAzAJ9HfoQfYmAUBI/yq+dDiE7WpB62cQCfd+/V
YBL6Q4lFIasbUnUWYTzlHf4=
=CBxw
-----END PGP SIGNATURE-----
Index: javax/swing/JFormattedTextField.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/JFormattedTextField.java,v
retrieving revision 1.3.2.3
diff -u -b -B -r1.3.2.3 JFormattedTextField.java
--- javax/swing/JFormattedTextField.java	29 Jun 2004 11:30:49 -0000	1.3.2.3
+++ javax/swing/JFormattedTextField.java	20 Jul 2004 19:35:33 -0000
@@ -214,9 +214,15 @@
     throw new InternalError ("not implemented");
   }
 
-  public void setDocument (Document document)
+  public void setDocument(Document newdoc)
   {
-    throw new InternalError ("not implemented");
+    Document document = getDocument();
+
+    if (document == newdoc)
+      return;
+    
+    setDocument(newdoc);
+    firePropertyChange("document", document, newdoc);
   }
 
   public void setLostFocusBehavior (int behavior)
Index: javax/swing/JRootPane.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/JRootPane.java,v
retrieving revision 1.4.2.9
diff -u -b -B -r1.4.2.9 JRootPane.java
--- javax/swing/JRootPane.java	13 Jul 2004 18:57:04 -0000	1.4.2.9
+++ javax/swing/JRootPane.java	20 Jul 2004 19:35:33 -0000
@@ -56,7 +56,7 @@
  * plane()) each on top of the others where you can add components to.
  * (getContentPane(), getGlassPane(), getLayeredPane())
  *
- * @author Ronald Veldema (rveldema at cs.vu.nl)
+ * @author Ronald Veldema (rveldema@cs.vu.nl)
  */
 public class JRootPane extends JComponent
 {
@@ -67,7 +67,7 @@
     private static final long serialVersionUID = 1082432482784468088L;
 
     /**
-     * Creates a new AccessibleJRootPane object.
+     * Creates a new <code>AccessibleJRootPane</code> object.
      */
     protected AccessibleJRootPane()
     {
@@ -92,7 +92,7 @@
     private static final long serialVersionUID = -4100116998559815027L;
 
     /**
-     * Creates a new RootLayout object.
+     * Creates a new <code>RootLayout</code> object.
      */
     protected RootLayout()
     {
@@ -440,7 +440,7 @@
   }
 
   /**
-   * Creates a new JRootPane object.
+   * Creates a new <code>JRootPane</code> object.
    */
   public JRootPane()
   {
Index: javax/swing/JTable.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/JTable.java,v
retrieving revision 1.4.18.3
diff -u -b -B -r1.4.18.3 JTable.java
--- javax/swing/JTable.java	20 Jul 2004 15:56:02 -0000	1.4.18.3
+++ javax/swing/JTable.java	20 Jul 2004 19:35:33 -0000
@@ -384,4 +384,10 @@
     
     return renderer;
   }
+
+  public TableCellRenderer getDefaultRenderer(Class columnClass)
+  {
+    // FIXME:
+    return null;
+  }
 }
Index: javax/swing/JTextField.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/JTextField.java,v
retrieving revision 1.2.18.5
diff -u -b -B -r1.2.18.5 JTextField.java
--- javax/swing/JTextField.java	18 Jun 2004 10:23:14 -0000	1.2.18.5
+++ javax/swing/JTextField.java	20 Jul 2004 19:35:33 -0000
@@ -37,6 +37,9 @@
 
 package javax.swing;
 
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.FontMetrics;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 
@@ -239,4 +242,29 @@
     repaint();
     firePropertyChange("horizontalAlignment", oldAlign, newAlign);
   }
+
+  public void setFont(Font newFont)
+  {
+    super.setFont(newFont);
+    revalidate();
+  }
+
+  public Dimension getPreferredSize()
+  {
+    Dimension size;
+    FontMetrics fm = getFontMetrics(getFont());
+    int fontHeight = fm.getMaxAscent() + fm.getMaxDescent();
+    int columnWidth = fm.charWidth('m');
+    
+    if (columns != 0)
+      {
+	size = new Dimension(columns * columnWidth + 4, fontHeight + 4);
+      }
+    else
+      {
+	size = new Dimension(10, 10);
+      }
+
+    return size;
+  }
 }
Index: javax/swing/JToggleButton.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/JToggleButton.java,v
retrieving revision 1.4.2.4
diff -u -b -B -r1.4.2.4 JToggleButton.java
--- javax/swing/JToggleButton.java	10 Jul 2004 17:53:03 -0000	1.4.2.4
+++ javax/swing/JToggleButton.java	20 Jul 2004 19:35:33 -0000
@@ -111,7 +111,9 @@
   }
 
   /**
-   * Gets the AccessibleContext associated with this JToggleButton.
+   * Gets the AccessibleContext associated with this <code>JToggleButton</code>.
+   *
+   * @return the associated context
    */
   public AccessibleContext getAccessibleContext()
   {
Index: javax/swing/JTree.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/JTree.java,v
retrieving revision 1.3.2.5
diff -u -b -B -r1.3.2.5 JTree.java
--- javax/swing/JTree.java	20 Jul 2004 15:56:02 -0000	1.3.2.5
+++ javax/swing/JTree.java	20 Jul 2004 19:35:33 -0000
@@ -147,31 +147,59 @@
     return null;
   }
 
+  /**
+   * Return the UI associated with this <code>JTree</code> object.
+   *
+   * @return the associated <code>TreeUI</code> object
+   */
   public TreeUI getUI()
   {
     return (TreeUI) ui;
   }
 
+  /**
+   * Sets the UI associated with this <code>JTree</code> object.
+   *
+   * @param ui the <code>TreeUI</code> to associate
+   */
   public void setUI(TreeUI ui)
   {
     super.setUI(ui);
   }
 
+  /**
+   * This method resets the UI used to the Look and Feel defaults..
+   */
   public void updateUI()
   {
     setUI((TreeUI) UIManager.getUI(this));
   }
 
+  /**
+   * This method returns the String ID of the UI class of  Separator.
+   *
+   * @return The UI class' String ID.
+   */
   public String getUIClassID()
   {
     return "TreeUI";
   }
 
+  /**
+   * Gets the AccessibleContext associated with this <code>JToggleButton</code>.
+   *
+   * @return the associated context
+   */
   public AccessibleContext getAccessibleContext()
   {
     return null;
   }
 
+  /**
+   * Returns the preferred viewport size..
+   *
+   * @return the preferred size
+   */
   public Dimension getPreferredScrollableViewportSize()
   {
     return null;
Index: javax/swing/JViewport.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/JViewport.java,v
retrieving revision 1.3.2.6
diff -u -b -B -r1.3.2.6 JViewport.java
--- javax/swing/JViewport.java	15 Jun 2004 22:28:05 -0000	1.3.2.6
+++ javax/swing/JViewport.java	20 Jul 2004 19:35:33 -0000
@@ -327,11 +327,19 @@
     listenerList.remove(ChangeListener.class, listener);
   }
 
+  /**
+   * This method returns the String ID of the UI class of  Separator.
+   *
+   * @return The UI class' String ID.
+   */
   public String getUIClassID()
   {
     return "ViewportUI";
   }
 
+  /**
+   * This method resets the UI used to the Look and Feel defaults..
+   */
   public void updateUI()
   {
     setUI((ViewportUI) UIManager.getUI(this));

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