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 - big improvements


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

Hi all,


I just commited the attached patch to improve mainly javax.swing.text 
but other parts of Swing too.


Michael


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

	* javax/swing/JFormattedTextField.java
	(value): New field.
	(JFormattedTextField): Implemented.
	(getValue): Likewise.
	(setValue): Likewise.
	* javax/swing/LookAndFeel.java
	(getSupportsWindowDecorations): New method.
	* javax/swing/UIDefaults.java:
	Use java.beans.PropertyChangeSupport instead of doing all ourself.
	(addPropertyChangeListener): Made public.
	(addResourceBundle): Likewise.
	(removeResourceBundle): Likewise.
	(setDefaultLocale): Likewise.
	* javax/swing/plaf/basic/BasicRootPaneUI.java
	(BasicRootPaneUI): Implements PropertyChangeListener.
	(propertyChange): New method.
	* javax/swing/plaf/basic/BasicTextUI.java
	(BasicHighlighter): New inner class.
	(createHighlighter): New method.
	* javax/swing/plaf/basic/BasicToolBarUI.java
	(DragWindow): Extends java.awt.Window.
	* javax/swing/text/JTextComponent.java
	(getDocument): Removed debug output.
	* javax/swing/plaf/basic/BasicTextFieldUI.java,
	javax/swing/text/DefaultHighlighter.java,
	javax/swing/text/FieldView.java,
	javax/swing/text/PlainView.java: New files.
	* Makefile.am: Added new files.
	* Makefile.in: Regenerated.
- -- 
Homepage: http://www.worldforge.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFA4VOvWSOgCCdjSDsRAh3zAJ4xZoBvbPglg99sR5lpA+GU1alPNACfX5QJ
ib39R65c8PnqNH5y1s5WO9k=
=z8t3
-----END PGP SIGNATURE-----
Index: javax/swing/JFormattedTextField.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/JFormattedTextField.java,v
retrieving revision 1.3.2.2
diff -u -b -B -r1.3.2.2 JFormattedTextField.java
--- javax/swing/JFormattedTextField.java	18 Jun 2004 10:23:14 -0000	1.3.2.2
+++ javax/swing/JFormattedTextField.java	29 Jun 2004 11:29:56 -0000
@@ -131,6 +131,8 @@
   public static final int REVERT = 2;
   public static final int PERSIST = 3;
 
+  private Object value;
+  
   public JFormattedTextField ()
   {
     throw new InternalError ("not implemented");
@@ -158,7 +160,7 @@
 
   public JFormattedTextField (Object value)
   {
-    throw new InternalError ("not implemented");
+    this.value = value;
   }
 
   public void commitEdit ()
@@ -194,7 +196,7 @@
 
   public Object getValue ()
   {
-    throw new InternalError ("not implemented");
+    return value;
   }
 
   protected void invalidEdit ()
@@ -232,8 +234,8 @@
     throw new InternalError ("not implemented");
   }
 
-  public void setValue (Object value)
+  public void setValue (Object newValue)
   {
-    throw new InternalError ("not implemented");
+    value = newValue;
   }
 }
Index: javax/swing/LookAndFeel.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/LookAndFeel.java,v
retrieving revision 1.2.18.3
diff -u -b -B -r1.2.18.3 LookAndFeel.java
--- javax/swing/LookAndFeel.java	11 Jun 2004 06:42:18 -0000	1.2.18.3
+++ javax/swing/LookAndFeel.java	29 Jun 2004 11:29:56 -0000
@@ -60,6 +60,20 @@
   public abstract String getName();
 
   /**
+   * Returns true when the Look and Feel supports window decorations,
+   * false others. This method returns always false and needs to be overwritten
+   * when the derived Look and Feel supports this.
+   *
+   * @return false
+   *
+   * @since 1.4
+   */
+  public boolean getSupportsWindowDecorations()
+  {
+    return false;
+  }
+  
+  /**
    * UIManager.setLookAndFeel calls this method before the first call
    * (and typically the only call) to getDefaults(). 
    */
Index: javax/swing/UIDefaults.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/UIDefaults.java,v
retrieving revision 1.7.2.4
diff -u -b -B -r1.7.2.4 UIDefaults.java
--- javax/swing/UIDefaults.java	28 Jun 2004 12:12:49 -0000	1.7.2.4
+++ javax/swing/UIDefaults.java	29 Jun 2004 11:29:56 -0000
@@ -43,17 +43,14 @@
 import java.awt.Insets;
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
 import java.lang.reflect.Method;
-import java.util.HashSet;
 import java.util.Hashtable;
-import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.ListIterator;
 import java.util.Locale;
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
-import java.util.Set;
-
 import javax.swing.border.Border;
 import javax.swing.plaf.ComponentUI;
 
@@ -66,10 +63,9 @@
  */
 public class UIDefaults extends Hashtable
 {
-
-  LinkedList bundles;
-  Set listeners;
-  Locale defaultLocale;
+  private LinkedList bundles;
+  private Locale defaultLocale;
+  private PropertyChangeSupport propertyChangeSupport;
 
   public interface ActiveValue
   {
@@ -217,7 +213,7 @@
   {
     bundles = new LinkedList();
     defaultLocale = Locale.getDefault();
-    listeners = new HashSet ();
+    propertyChangeSupport = new PropertyChangeSupport(this);
   }
 
   public UIDefaults(Object[] entries)
@@ -476,43 +472,38 @@
       }
   }
 
-  void addPropertyChangeListener(PropertyChangeListener listener)
+  public void addPropertyChangeListener(PropertyChangeListener listener)
   {
-    listeners.add (listener);
+    propertyChangeSupport.addPropertyChangeListener(listener);
   }
 
   void removePropertyChangeListener(PropertyChangeListener listener)
   {
-    listeners.remove (listener);
+    propertyChangeSupport.removePropertyChangeListener(listener);
   }
 
   public PropertyChangeListener[] getPropertyChangeListeners()
   {
-    return (PropertyChangeListener[]) listeners.toArray ();
+    return propertyChangeSupport.getPropertyChangeListeners();
   }
 
-  protected void firePropertyChange(String property, Object o, Object n)
+  protected void firePropertyChange(String property,
+				    Object oldValue, Object newValue)
   {
-    Iterator i = listeners.iterator ();
-    PropertyChangeEvent pce = new PropertyChangeEvent (this, property, o, n);
-    while (i.hasNext ())
-      {
-        PropertyChangeListener pcl = (PropertyChangeListener) i.next ();
-        pcl.propertyChange (pce);
-      }
+    propertyChangeSupport.firePropertyChange(property, oldValue, newValue);
   }
 
-  void addResourceBundle(String name)
+  public void addResourceBundle(String name)
   {
     bundles.addFirst(name);
   }
 
-  void removeResourceBundle(String name)
+  public void removeResourceBundle(String name)
   {
     bundles.remove(name);
   }
 
-  void setDefaultLocale(Locale loc)
+  public void setDefaultLocale(Locale loc)
   {
     defaultLocale = loc;
   }
Index: javax/swing/plaf/basic/BasicRootPaneUI.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/plaf/basic/BasicRootPaneUI.java,v
retrieving revision 1.1.2.4
diff -u -b -B -r1.1.2.4 BasicRootPaneUI.java
--- javax/swing/plaf/basic/BasicRootPaneUI.java	28 Jun 2004 11:19:22 -0000	1.1.2.4
+++ javax/swing/plaf/basic/BasicRootPaneUI.java	29 Jun 2004 11:29:56 -0000
@@ -38,6 +38,8 @@
 
 package javax.swing.plaf.basic;
 
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
 import javax.swing.JComponent;
 import javax.swing.UIManager;
 import javax.swing.plaf.ComponentUI;
@@ -45,6 +47,7 @@
 
 
 public class BasicRootPaneUI extends RootPaneUI
+  implements PropertyChangeListener
 {
   public static ComponentUI createUI(JComponent x) 
   {
@@ -57,4 +60,8 @@
     c.setBackground(UIManager.getColor("control"));
     super.installUI(c);
   }
+
+  public void propertyChange(PropertyChangeEvent event)
+  {
+  }
 }
Index: javax/swing/plaf/basic/BasicTextUI.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/plaf/basic/BasicTextUI.java,v
retrieving revision 1.4.16.5
diff -u -b -B -r1.4.16.5 BasicTextUI.java
--- javax/swing/plaf/basic/BasicTextUI.java	28 Jun 2004 12:12:50 -0000	1.4.16.5
+++ javax/swing/plaf/basic/BasicTextUI.java	29 Jun 2004 11:29:56 -0000
@@ -55,6 +55,7 @@
 import javax.swing.text.Caret;
 import javax.swing.text.DefaultCaret;
 import javax.swing.text.DefaultEditorKit;
+import javax.swing.text.DefaultHighlighter;
 import javax.swing.text.Document;
 import javax.swing.text.EditorKit;
 import javax.swing.text.Element;
@@ -77,6 +78,14 @@
     }
   }
 
+  public static class BasicHighlighter extends DefaultHighlighter
+    implements UIResource
+  {
+    public BasicHighlighter()
+    {
+    }
+  }
+  
   private class RootView extends View
   {
     private JTextComponent textComponent;
@@ -135,6 +144,11 @@
     return new BasicCaret();
   }
 
+  protected Highlighter createHighlighter()
+  {
+    return new BasicHighlighter();
+  }
+  
   protected final JTextComponent getComponent()
   {
     return textComponent;
Index: javax/swing/plaf/basic/BasicToolBarUI.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/plaf/basic/BasicToolBarUI.java,v
retrieving revision 1.1.2.2
diff -u -b -B -r1.1.2.2 BasicToolBarUI.java
--- javax/swing/plaf/basic/BasicToolBarUI.java	23 Jun 2004 13:29:00 -0000	1.1.2.2
+++ javax/swing/plaf/basic/BasicToolBarUI.java	29 Jun 2004 11:29:56 -0000
@@ -44,6 +44,7 @@
 import java.awt.Dimension;
 import java.awt.GridLayout;
 import java.awt.Point;
+import java.awt.Window;
 import java.awt.event.ContainerListener;
 import java.awt.event.FocusListener;
 import java.awt.event.MouseAdapter;
@@ -68,9 +69,9 @@
 public class BasicToolBarUI extends ToolBarUI
   implements SwingConstants
 {
-
-  public class DragWindow
-  {}
+  public class DragWindow extends Window
+  {
+  }
 
     protected String constraintBeforeFloating;
     protected Color dockingBorderColor;
Index: javax/swing/plaf/basic/BasicTextFieldUI.java
===================================================================
RCS file: javax/swing/plaf/basic/BasicTextFieldUI.java
diff -N javax/swing/plaf/basic/BasicTextFieldUI.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ javax/swing/plaf/basic/BasicTextFieldUI.java	29 Jun 2004 11:29:57 -0000
@@ -0,0 +1,82 @@
+/* BasicTextFieldUI.java
+   Copyright (C) 2004  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing.plaf.basic;
+
+import java.beans.PropertyChangeEvent;
+
+import javax.swing.JComponent;
+import javax.swing.JTextField;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.text.Element;
+import javax.swing.text.FieldView;
+import javax.swing.text.PlainDocument;
+import javax.swing.text.View;
+
+public class BasicTextFieldUI extends BasicTextUI
+{
+  public BasicTextFieldUI()
+  {
+    super();
+  }
+
+  public View create(Element elem)
+  {
+    return new FieldView(elem);
+  }
+  
+  public static ComponentUI createUI(JComponent c)
+  {
+    return new BasicTextFieldUI();
+  }
+
+  protected String getPropertyPrefix()
+  {
+    return "TextField";
+  }
+
+  public void installUI(JComponent c)
+  {
+    super.installUI(c);
+  }
+
+  protected void propertyChange(PropertyChangeEvent event)
+  {
+    // Does nothing by default.
+  }
+}
Index: javax/swing/text/JTextComponent.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/text/JTextComponent.java,v
retrieving revision 1.4.2.12
diff -u -b -B -r1.4.2.12 JTextComponent.java
--- javax/swing/text/JTextComponent.java	28 Jun 2004 11:14:07 -0000	1.4.2.12
+++ javax/swing/text/JTextComponent.java	29 Jun 2004 11:29:57 -0000
@@ -306,8 +306,6 @@
 
   public Document getDocument()
   {
-    if (doc == null)
-      System.out.println("doc == null !!!");
     return doc;
   }
 
Index: javax/swing/text/DefaultHighlighter.java
===================================================================
RCS file: javax/swing/text/DefaultHighlighter.java
diff -N javax/swing/text/DefaultHighlighter.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ javax/swing/text/DefaultHighlighter.java	29 Jun 2004 11:29:57 -0000
@@ -0,0 +1,136 @@
+/* DefaultHighlighter.java --
+   Copyright (C) 2004  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing.text;
+
+import java.awt.Graphics;
+import java.awt.Shape;
+import java.util.Vector;
+
+import javax.swing.text.JTextComponent;
+import javax.swing.text.View;
+
+
+public class DefaultHighlighter extends LayeredHighlighter
+{
+  private class HighlightEntry
+  {
+    int p0;
+    int p1;
+    Highlighter.HighlightPainter painter;
+
+    public HighlightEntry(int p0, int p1, Highlighter.HighlightPainter painter)
+    {
+      this.p0 = p0;
+      this.p1 = p1;
+      this.painter = painter;
+    }
+
+    public int getStartPosition()
+    {
+      return p0;
+    }
+
+    public int getEndPosition()
+    {
+      return p1;
+    }
+
+    public Highlighter.HighlightPainter getPainter()
+    {
+      return painter;
+    }
+  }
+
+  private JTextComponent textComponent;
+  private Vector highlights = new Vector();
+  
+  public DefaultHighlighter()
+  {
+  }
+
+  public void install(JTextComponent c)
+  {
+    textComponent = c;
+    removeAllHighlights();
+  }
+
+  public void deinstall(JTextComponent c)
+  {
+    textComponent = null;
+  }
+
+  public Object addHighlight(int p0, int p1, Highlighter.HighlightPainter painter)
+  {
+    HighlightEntry entry = new HighlightEntry(p0, p1, painter);
+    highlights.add(entry);
+    return entry;
+  }
+
+  public void removeHighlight(Object tag)
+  {
+    highlights.remove(tag);
+  }
+
+  public void removeAllHighlights()
+  {
+    highlights.clear();
+  }
+
+  public Highlighter.Highlight[] getHighlights()
+  {
+    return null;
+  }
+
+  public void changeHighlight(Object tag, int p0, int p1)
+  {
+    HighlightEntry entry = (HighlightEntry) tag;
+    entry.p0 = p0;
+    entry.p1 = p1;
+  }
+
+  public void paintLayeredHighlights(Graphics g, int p0, int p1,
+                                     Shape viewBounds, JTextComponent editor,
+                                     View view)
+  {
+  }
+
+  public void paint(Graphics g)
+  {
+  }
+}
Index: javax/swing/text/FieldView.java
===================================================================
RCS file: javax/swing/text/FieldView.java
diff -N javax/swing/text/FieldView.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ javax/swing/text/FieldView.java	29 Jun 2004 11:29:57 -0000
@@ -0,0 +1,97 @@
+/* FieldView.java -- 
+   Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing.text;
+
+import java.awt.Component;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Shape;
+
+
+public class FieldView extends PlainView
+{
+  public FieldView(Element elem)
+  {
+    super(elem);
+  }
+
+  protected FontMetrics getFontMetrics()
+  {
+    Component container = getContainer();
+    return container.getFontMetrics(container.getFont());
+  }
+
+  public float getPreferredSpan(int axis)
+  {
+    if (axis != X_AXIS && axis != Y_AXIS)
+      throw new IllegalArgumentException();
+
+    FontMetrics fm = getFontMetrics();
+
+    if (axis == Y_AXIS)
+      return fm.getHeight();
+
+    String text;
+    Element elem = getElement();
+
+    try
+      {
+	text = elem.getDocument().getText(elem.getStartOffset(),
+					  elem.getEndOffset());
+      }
+    catch (BadLocationException e)
+      {
+	// This should never happen.
+	text = "";
+	System.out.println("Michael: FieldView.getPreferredSpan: Error");
+      }
+    
+    return fm.stringWidth(text);
+  }
+
+  public int getResizeWeight(int axis)
+  {
+    return axis = axis == X_AXIS ? 1 : 0;
+  }
+  
+  public void paint(Graphics g, Shape s)
+  {
+    drawLine(0, g, 0, 0);
+  }
+}
Index: javax/swing/text/PlainView.java
===================================================================
RCS file: javax/swing/text/PlainView.java
diff -N javax/swing/text/PlainView.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ javax/swing/text/PlainView.java	29 Jun 2004 11:29:57 -0000
@@ -0,0 +1,122 @@
+/* PlainView.java -- 
+   Copyright (C) 2004  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing.text;
+
+import java.awt.Color;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Rectangle;
+import java.awt.Shape;
+
+
+public class PlainView extends View
+  implements TabExpander
+{
+  protected FontMetrics metrics;
+
+  public PlainView(Element elem)
+  {
+    super(elem);
+  }
+  
+  public void drawLine(int lineIndex, Graphics g, int x, int y)
+  {
+    try
+      {
+	metrics = g.getFontMetrics();
+	// FIXME: Selected text are not drawn yet.
+	drawUnselectedText(g, x, y, 0, getDocument().getLength());
+	//drawSelectedText(g, , , , );
+      }
+    catch (BadLocationException e)
+      {
+	// This should never happen.
+      }
+  }
+
+  public int drawSelectedText(Graphics g, int x, int y, int p0, int p1)
+    throws BadLocationException
+  {
+    String text = getDocument().getText(p0, p1);
+    g.setColor(Color.WHITE);
+    g.drawString(text, x, y);
+    return metrics.stringWidth(text);
+  }
+
+  public int drawUnselectedText(Graphics g, int x, int y, int p0, int p1)
+    throws BadLocationException
+  {
+    String text = getDocument().getText(p0, p1);
+    g.setColor(Color.BLACK);
+    g.drawString(text, x, y);
+    return metrics.stringWidth(text);
+  }
+
+  public void paint(Graphics g, Shape s)
+  {
+    System.out.println("Michael: PlainView.paint");
+    
+    Rectangle rect = s.getBounds();
+
+    g.setColor(Color.WHITE);
+    g.fillRect(rect.x, rect.y, rect.width, rect.height);
+    
+    // FIXME: Text may be scrolled.
+    drawLine(0, g, rect.x, rect.y);
+  }
+
+  public int getTabSize()
+  {
+    return 8;
+  }
+
+  public float nextTabStop(float x, int tabStop)
+  {
+    System.out.println("Michael: PlainView.nextTabpStop: missing implementation");
+    return x;
+  }
+
+  public float getPreferredSpan(int axis)
+  {
+    if (axis != X_AXIS && axis != Y_AXIS)
+      throw new IllegalArgumentException();
+
+    return 10;
+  }
+}
\ No newline at end of file
Index: Makefile.am
===================================================================
RCS file: /cvs/gcc/gcc/libjava/Makefile.am,v
retrieving revision 1.361.2.22
diff -u -b -B -r1.361.2.22 Makefile.am
--- Makefile.am	29 Jun 2004 07:49:09 -0000	1.361.2.22
+++ Makefile.am	29 Jun 2004 11:29:58 -0000
@@ -1324,6 +1324,7 @@
 javax/swing/plaf/basic/BasicSplitPaneDivider.java \
 javax/swing/plaf/basic/BasicSplitPaneUI.java \
 javax/swing/plaf/basic/BasicTabbedPaneUI.java \
+javax/swing/plaf/basic/BasicTextFieldUI.java \
 javax/swing/plaf/basic/BasicTextUI.java \
 javax/swing/plaf/basic/BasicToggleButtonUI.java \
 javax/swing/plaf/basic/BasicToolBarUI.java \
@@ -1496,16 +1497,19 @@
 javax/swing/text/ComponentView.java \
 javax/swing/text/DefaultCaret.java \
 javax/swing/text/DefaultEditorKit.java \
+javax/swing/text/DefaultHighlighter.java \
 javax/swing/text/Document.java \
 javax/swing/text/DocumentFilter.java \
 javax/swing/text/EditorKit.java \
 javax/swing/text/Element.java \
+javax/swing/text/FieldView.java \
 javax/swing/text/GapContent.java \
 javax/swing/text/Highlighter.java \
 javax/swing/text/JTextComponent.java \
 javax/swing/text/Keymap.java \
 javax/swing/text/LayeredHighlighter.java \
 javax/swing/text/PlainDocument.java \
+javax/swing/text/PlainView.java \
 javax/swing/text/Position.java \
 javax/swing/text/Segment.java \
 javax/swing/text/Style.java \
Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/libjava/Makefile.in,v
retrieving revision 1.385.2.22
diff -u -b -B -r1.385.2.22 Makefile.in
--- Makefile.in	29 Jun 2004 07:49:10 -0000	1.385.2.22
+++ Makefile.in	29 Jun 2004 11:30:01 -0000
@@ -1002,6 +1002,7 @@
 javax/swing/plaf/basic/BasicSplitPaneDivider.java \
 javax/swing/plaf/basic/BasicSplitPaneUI.java \
 javax/swing/plaf/basic/BasicTabbedPaneUI.java \
+javax/swing/plaf/basic/BasicTextFieldUI.java \
 javax/swing/plaf/basic/BasicTextUI.java \
 javax/swing/plaf/basic/BasicToggleButtonUI.java \
 javax/swing/plaf/basic/BasicToolBarUI.java \
@@ -1174,16 +1175,19 @@
 javax/swing/text/ComponentView.java \
 javax/swing/text/DefaultCaret.java \
 javax/swing/text/DefaultEditorKit.java \
+javax/swing/text/DefaultHighlighter.java \
 javax/swing/text/Document.java \
 javax/swing/text/DocumentFilter.java \
 javax/swing/text/EditorKit.java \
 javax/swing/text/Element.java \
+javax/swing/text/FieldView.java \
 javax/swing/text/GapContent.java \
 javax/swing/text/Highlighter.java \
 javax/swing/text/JTextComponent.java \
 javax/swing/text/Keymap.java \
 javax/swing/text/LayeredHighlighter.java \
 javax/swing/text/PlainDocument.java \
+javax/swing/text/PlainView.java \
 javax/swing/text/Position.java \
 javax/swing/text/Segment.java \
 javax/swing/text/Style.java \
@@ -3126,6 +3130,7 @@
 javax/swing/plaf/basic/BasicSplitPaneDivider.lo \
 javax/swing/plaf/basic/BasicSplitPaneUI.lo \
 javax/swing/plaf/basic/BasicTabbedPaneUI.lo \
+javax/swing/plaf/basic/BasicTextFieldUI.lo \
 javax/swing/plaf/basic/BasicTextUI.lo \
 javax/swing/plaf/basic/BasicToggleButtonUI.lo \
 javax/swing/plaf/basic/BasicToolBarUI.lo \
@@ -3240,15 +3245,18 @@
 javax/swing/text/AbstractDocument.lo javax/swing/text/AttributeSet.lo \
 javax/swing/text/BadLocationException.lo javax/swing/text/Caret.lo \
 javax/swing/text/ComponentView.lo javax/swing/text/DefaultCaret.lo \
-javax/swing/text/DefaultEditorKit.lo javax/swing/text/Document.lo \
+javax/swing/text/DefaultEditorKit.lo \
+javax/swing/text/DefaultHighlighter.lo javax/swing/text/Document.lo \
 javax/swing/text/DocumentFilter.lo javax/swing/text/EditorKit.lo \
-javax/swing/text/Element.lo javax/swing/text/GapContent.lo \
-javax/swing/text/Highlighter.lo javax/swing/text/JTextComponent.lo \
-javax/swing/text/Keymap.lo javax/swing/text/LayeredHighlighter.lo \
-javax/swing/text/PlainDocument.lo javax/swing/text/Position.lo \
-javax/swing/text/Segment.lo javax/swing/text/Style.lo \
-javax/swing/text/TabExpander.lo javax/swing/text/View.lo \
-javax/swing/text/ViewFactory.lo javax/swing/text/MutableAttributeSet.lo \
+javax/swing/text/Element.lo javax/swing/text/FieldView.lo \
+javax/swing/text/GapContent.lo javax/swing/text/Highlighter.lo \
+javax/swing/text/JTextComponent.lo javax/swing/text/Keymap.lo \
+javax/swing/text/LayeredHighlighter.lo \
+javax/swing/text/PlainDocument.lo javax/swing/text/PlainView.lo \
+javax/swing/text/Position.lo javax/swing/text/Segment.lo \
+javax/swing/text/Style.lo javax/swing/text/TabExpander.lo \
+javax/swing/text/View.lo javax/swing/text/ViewFactory.lo \
+javax/swing/text/MutableAttributeSet.lo \
 javax/swing/text/NavigationFilter.lo javax/swing/text/StyledDocument.lo \
 javax/swing/text/StyledEditorKit.lo javax/swing/text/TextAction.lo \
 javax/swing/text/html/HTML.lo \
@@ -5292,6 +5300,7 @@
 .deps/javax/swing/plaf/basic/BasicSplitPaneDivider.P \
 .deps/javax/swing/plaf/basic/BasicSplitPaneUI.P \
 .deps/javax/swing/plaf/basic/BasicTabbedPaneUI.P \
+.deps/javax/swing/plaf/basic/BasicTextFieldUI.P \
 .deps/javax/swing/plaf/basic/BasicTextUI.P \
 .deps/javax/swing/plaf/basic/BasicToggleButtonUI.P \
 .deps/javax/swing/plaf/basic/BasicToolBarUI.P \
@@ -5314,18 +5323,20 @@
 .deps/javax/swing/text/Caret.P .deps/javax/swing/text/ComponentView.P \
 .deps/javax/swing/text/DefaultCaret.P \
 .deps/javax/swing/text/DefaultEditorKit.P \
+.deps/javax/swing/text/DefaultHighlighter.P \
 .deps/javax/swing/text/Document.P \
 .deps/javax/swing/text/DocumentFilter.P \
 .deps/javax/swing/text/EditorKit.P .deps/javax/swing/text/Element.P \
-.deps/javax/swing/text/GapContent.P \
+.deps/javax/swing/text/FieldView.P .deps/javax/swing/text/GapContent.P \
 .deps/javax/swing/text/Highlighter.P \
 .deps/javax/swing/text/JTextComponent.P .deps/javax/swing/text/Keymap.P \
 .deps/javax/swing/text/LayeredHighlighter.P \
 .deps/javax/swing/text/MutableAttributeSet.P \
 .deps/javax/swing/text/NavigationFilter.P \
 .deps/javax/swing/text/PlainDocument.P \
-.deps/javax/swing/text/Position.P .deps/javax/swing/text/Segment.P \
-.deps/javax/swing/text/Style.P .deps/javax/swing/text/StyledDocument.P \
+.deps/javax/swing/text/PlainView.P .deps/javax/swing/text/Position.P \
+.deps/javax/swing/text/Segment.P .deps/javax/swing/text/Style.P \
+.deps/javax/swing/text/StyledDocument.P \
 .deps/javax/swing/text/StyledEditorKit.P \
 .deps/javax/swing/text/TabExpander.P \
 .deps/javax/swing/text/TextAction.P .deps/javax/swing/text/View.P \

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