Patch: more AWT code

Tom Tromey tromey@redhat.com
Tue Jan 2 16:06:00 GMT 2001


Here's the last of the AWT code I wrote on vacation.

It implements most of ScrollPane, fixes a few problems, and adds some
missing methods.

2001-01-02  Tom Tromey  <tromey@redhat.com>

	* java/awt/ScrollPane.java: Wrote.
	* java/awt/peer/ScrollPanePeer.java (setBlockIncrement): New
	method.

	* java/awt/Panel.java (Panel()): Fixed.

	* java/awt/Component.java (isShowing): Return false if no peer
	exists, and true if component is visible and no parent exists.
	(getLocationOnScreen): Wrote.
	(getPreferredSize): Removed FIXME comment.
	(getMinimumSize): Likewise.
	(getAlignmentX, getAlignmentY): Wrote.
	(list): Wrote.
	(requestFocus): Wrote.
	(transferFocus): Wrote.
	(findNextFocusComponent): New method.
	(hasFocus()): Wrote.
	(checkImage): Wrote.
	(enableEvents): Call setEventMask on the peer.

	* java/awt/Container.java (list): Use super.list() to print self.
	(findNextFocusComponent): New method.
	(setLayout): Call invalidate.
	(findComponentAt): Wrote.

Tom

Index: java/awt/Component.java
===================================================================
RCS file: /cvs/gcc/egcs/libjava/java/awt/Component.java,v
retrieving revision 1.15
diff -u -r1.15 Component.java
--- Component.java	2000/12/26 00:25:12	1.15
+++ Component.java	2001/01/02 23:59:25
@@ -205,13 +205,10 @@
   
   public boolean isShowing()
   {
-    if (! visible)
+    if (! visible || peer == null)
       return false;
 
-    if (parent != null)
-      return (parent.isShowing());
-
-    return false;
+    return parent == null ? true : parent.isShowing ();
   }
   
   public boolean isEnabled()
@@ -377,8 +374,11 @@
 
   public Point getLocationOnScreen()
   {
-    // FIXME
-    return null;
+    if (! isShowing ())
+      throw new IllegalComponentStateException ("component not showing");
+
+    // We know peer != null here.
+    return peer.getLocationOnScreen ();
   }
 
   /** @deprecated Use getLocation() instead. */
@@ -560,7 +560,6 @@
   
   public Dimension getPreferredSize()
   {
-    // FIXME?
     if (peer == null)
       return new Dimension(width, height);
     else
@@ -575,7 +574,6 @@
   
   public Dimension getMinimumSize()
   {
-    // FIXME?
     if (peer == null)
       return new Dimension(width, height);
     else
@@ -587,24 +585,22 @@
   {
     return getMinimumSize();
   }
-  
+
   public Dimension getMaximumSize()
   {
     return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
   }
-  
+
   public float getAlignmentX()
   {
-    // FIXME
-    return 0;
+    return CENTER_ALIGNMENT;
   }
-  
+
   public float getAlignmentY()
   {
-    // FIXME
-    return 0;
+    return CENTER_ALIGNMENT;
   }
-  
+
   public void doLayout()
   {
     // nothing to do unless we're a container
@@ -626,9 +622,9 @@
     valid = false;
 
     if ((parent != null) && parent.valid)
-	parent.invalidate ();
+      parent.invalidate ();
   }
-  
+
   public Graphics getGraphics()
   {
     if (peer != null)
@@ -713,40 +709,41 @@
     if (peer != null)
       peer.repaint(tm, x, y, width, height);
   }
-  
+
   public void print(Graphics g)
   {
     paint(g);
   }
-  
+
   public void printAll(Graphics g)
   {
     paintAll(g);
   }
-  
-  public boolean imageUpdate(Image img, int infoflags, int x, int y, int w, int h)
+
+  public boolean imageUpdate (Image img, int infoflags, int x, int y,
+			      int w, int h)
   {
     // FIXME
     return false;
   }
-  
+
   public Image createImage(ImageProducer producer)
   {
     // FIXME
     return null;
   }
-  
+
   public Image createImage(int width, int height)
   {
     return getGraphicsConfiguration().createCompatibleImage(width, height);
   }
-  
+
   public boolean prepareImage(Image image, ImageObserver observer)
   {
     // FIXME
     return false;
   }
-  
+
   public boolean prepareImage(Image image, int width, int height, ImageObserver observer)
   {
     // FIXME
@@ -758,53 +755,54 @@
     // FIXME
     return 0;
   }
-  
-  public int checkImage(Image image, int width, int height, ImageObserver observer)
+
+  public int checkImage (Image image, int width, int height, ImageObserver observer)
   {
-    // FIXME
-    return 0; 
+    if (peer != null)
+      return peer.checkImage (image, width, height, observer);
+    return getToolkit ().checkImage (image, width, height, observer);
   }
-  
-  public boolean contains(int x, int y)
+
+  public boolean contains (int x, int y)
   {
     return (x >= 0) && (y >= 0) && (x < width) && (y < height);
   }
-  
+
   /** @deprecated */
   public boolean inside(int x, int y)
   {
     return contains(x,y);
   }
-  
+
   public boolean contains(Point p)
   {
     return contains(p.x, p.y);
   }
-  
+
   public Component getComponentAt(int x, int y)
   {
     if (contains(x,y))
       return this;
     return null;
   }
-  
+
   /** @deprecated */
   public Component locate(int x, int y)
   {
     return getComponentAt(x, y);
   }
-  
+
   public Component getComponentAt(Point p)
   {
     return getComponentAt(p.x, p.y);
   }
-    
+
   /** @deprecated */
   public void deliverEvent(Event e)
   {
     
   }
-  
+
   /** Forward AWT events to processEvent() if:
     *     - Events have been enabled for this type of event via enableEvents(),
     *   OR:
@@ -826,7 +824,7 @@
     if (peer != null)
       peer.handleEvent(e);
   }
-  
+
   void dispatchEventImpl(AWTEvent e)
   {
     // Make use of event id's in order to avoid multiple instanceof tests.
@@ -1019,7 +1017,7 @@
     v.copyInto(el_a);
     return el_a;
   }
-  
+
   static void getListenerList(EventListener el, Vector v)
   {
     if (el instanceof AWTEventMulticaster)
@@ -1040,7 +1038,7 @@
   // /** @since 1.2 */
   //
   // public InputContext getInputContext()
-  
+
   protected final void enableEvents(long eventsToEnable)
   {
     eventMask |= eventsToEnable;
@@ -1054,14 +1052,16 @@
 
     if (isLightweight() && (parent != null))
       parent.enableEvents(eventsToEnable);
+    else if (peer != null)
+      peer.setEventMask (eventMask);
   }
-  
+
   protected final void disableEvents(long eventsToDisable)
   {
     eventMask &= ~eventsToDisable;
     // forward new event mask to peer?
   }
-  
+
   /** coalesceEvents is called by the EventQueue if two events with the same 
     * event id are queued. Returns a new combined event, or null if no 
     * combining is done. 
@@ -1437,45 +1437,61 @@
 
   public boolean isFocusTraversable()
   {
-    // FIXME
-    return false;
+    return enabled && visible && (peer == null || peer.isFocusTraversable ());
   }
-  
+
   public void requestFocus()
   {
-    // FIXME
+    // If there's no peer then this component can't get the focus.  We
+    // treat it as a silent rejection of the request.
+    if (peer != null)
+      peer.requestFocus ();
   }
-  
+
+  // This method is used to implement transferFocus().
+  // CHILD is the child making the request.
+  // This is overridden by Container; when called for an ordinary
+  // component there is no child and so we always return null.
+  Component findNextFocusComponent (Component child)
+  {
+    return null;
+  }
+
   public void transferFocus()
   {
-    // FIXME
+    Component next;
+    if (parent == null)
+      next = findNextFocusComponent (null);
+    else
+      next = parent.findNextFocusComponent (this);
+    if (next != null && next != this)
+      next.requestFocus ();
   }
-  
+
   /** @deprecated */
   public void nextFocus()
   {
     transferFocus();
   }
-  
+
   /** @since 1.2 */
   public boolean hasFocus()
   {
-    // FIXME
-    return false;
+    return hasFocus;
   }
-  
+
   public synchronized void add(PopupMenu popup)
   {
     if (popups == null)
       popups = new Vector();
     popups.addElement(popup);    
   }
-  
+
   public synchronized void remove(MenuComponent popup)
   {
     popups.removeElement(popup);
   }
-  
+
   protected String paramString()
   {
     StringBuffer param = new StringBuffer();
@@ -1506,47 +1522,54 @@
     
     return param.toString();
   }
-  
+
   public String toString()
   {
     return this.getClass().getName() + "[" + paramString() + "]";
   }
-  
-  public void list()
+
+  public void list ()
   {
-    list(System.out);
+    list (System.out, 0);
   }
-  
-  public void list(PrintStream out)
+
+  public void list (PrintStream out)
   {
-    list(out, 0);
+    list (out, 0);
   }
-  
-  public void list(PrintStream out, int indent)
+
+  public void list (PrintStream out, int indent)
   {
+    for (int i = 0; i < indent; ++i)
+      out.print (' ');
+    out.println (toString ());
   }
-  
-  public void list(PrintWriter out)
+
+  public void list (PrintWriter out)
   {
+    list (out, 0);
   }
-  
-  public void list(PrintWriter out, int indent)
+
+  public void list (PrintWriter out, int indent)
   {
+    for (int i = 0; i < indent; ++i)
+      out.print (' ');
+    out.println (toString ());
   }
-  
+
   public void addPropertyChangeListener(PropertyChangeListener listener)
   {
     if (changeSupport == null)
       changeSupport = new PropertyChangeSupport(this);
     changeSupport.addPropertyChangeListener(listener);
   }
-  
+
   public void removePropertyChangeListener(PropertyChangeListener listener)
   {
     if (changeSupport != null)
       changeSupport.removePropertyChangeListener(listener);         
   }
-  
+
   public void addPropertyChangeListener(String propertyName,
                                 	PropertyChangeListener listener)
   {
@@ -1554,21 +1577,21 @@
       changeSupport = new PropertyChangeSupport(this);
     changeSupport.addPropertyChangeListener(propertyName, listener);  
   }
-  
+
   public void removePropertyChangeListener(String propertyName,
                                            PropertyChangeListener listener)
   {
     if (changeSupport != null)
       changeSupport.removePropertyChangeListener(propertyName, listener);
   }
-  
+
   protected void firePropertyChange(String propertyName, Object oldValue, 
                                     Object newValue)
   {
     if (changeSupport != null)
       changeSupport.firePropertyChange(propertyName, oldValue, newValue);    
   }
-  
+
   public void setComponentOrientation(ComponentOrientation o)
   {
     orientation = o;
Index: java/awt/Container.java
===================================================================
RCS file: /cvs/gcc/egcs/libjava/java/awt/Container.java,v
retrieving revision 1.10
diff -u -r1.10 Container.java
--- Container.java	2000/12/26 00:25:12	1.10
+++ Container.java	2001/01/02 23:59:26
@@ -119,7 +119,7 @@
     if (peer != null)
       {
 	comp.addNotify ();
-    
+
 	if (comp.isLightweight())
 	  enableEvents(comp.eventMask);
       }
@@ -127,7 +127,7 @@
     invalidate ();
 
     if (component == null)
-	component = new Component[4]; // FIXME, better initial size?
+      component = new Component[4]; // FIXME, better initial size?
 
     // This isn't the most efficient implementation.  We could do less
     // copying when growing the array.  It probably doesn't matter.
@@ -209,13 +209,13 @@
   {
     return layoutMgr;
   }
-  
+
   public void setLayout(LayoutManager mgr)
   {
     layoutMgr = mgr;
-    // FIXME
+    invalidate ();
   }
-  
+
   public void doLayout()
   {
     if (layoutMgr != null)
@@ -496,7 +496,7 @@
 	// Ignore invisible children...
 	if (!component[i].isVisible())
 	  continue;
-	
+
 	int x2 = x - component[i].x;
 	int y2 = y - component[i].y;
 	if (component[i].contains (x2, y2))
@@ -516,10 +516,33 @@
     return getComponentAt(p.x, p.y);
   }
 
-  public Component findComponentAt(int x, int y)
+  public Component findComponentAt (int x, int y)
   {
-    // FIXME
-    return null;
+    if (! contains (x, y))
+      return null;
+
+    for (int i = 0; i < ncomponents; ++i)
+      {
+	// Ignore invisible children...
+	if (!component[i].isVisible())
+	  continue;
+
+	int x2 = x - component[i].x;
+	int y2 = y - component[i].y;
+	// We don't do the contains() check right away because
+	// findComponentAt would redundantly do it first thing.
+	if (component[i] instanceof Container)
+	  {
+	    Container k = (Container) component[i];
+	    Component r = k.findComponentAt (x2, y2);
+	    if (r != null)
+	      return r;
+	  }
+	else if (component[i].contains (x2, y2))
+	  return component[i];
+      }
+
+    return this;
   }
 
   public Component findComponentAt(Point p)
@@ -572,18 +595,14 @@
   
   public void list (PrintStream out, int indent)
   {
-    for (int i = 0; i < indent; ++i)
-      out.print (' ');
-    out.println (toString ());
+    super.list (out, indent);
     for (int i = 0; i < ncomponents; ++i)
       component[i].list (out, indent + 2);
   }
 
   public void list(PrintWriter out, int indent)
   {
-    for (int i = 0; i < indent; ++i)
-      out.print (' ');
-    out.println (toString ());
+    super.list (out, indent);
     for (int i = 0; i < ncomponents; ++i)
       component[i].list (out, indent + 2);
   }
@@ -622,4 +641,52 @@
     public static final GfxVisitor INSTANCE = new GfxPrintAllVisitor();
   }
 
+  // This is used to implement Component.transferFocus.
+  Component findNextFocusComponent (Component child)
+  {
+    int start, end;
+    if (child != null)
+      {
+	for (start = 0; start < ncomponents; ++start)
+	  {
+	    if (component[start] == child)
+	      break;
+	  }
+	end = start;
+	// This special case lets us be sure to terminate.
+	if (end == 0)
+	  end = ncomponents;
+	++start;
+      }
+    else
+      {
+	start = 0;
+	end = ncomponents;
+      }
+
+    for (int j = start; j != end; ++j)
+      {
+	if (j >= ncomponents)
+	  {
+	    // The JCL says that we should wrap here.  However, that
+	    // seems wrong.  To me it seems that focus order should be
+	    // global within in given window.  So instead if we reach
+	    // the end we try to look in our parent, if we have one.
+	    if (parent != null)
+	      return parent.findNextFocusComponent (this);
+	    j -= ncomponents;
+	  }
+	if (component[j] instanceof Container)
+	  {
+	    Component c = component[j];
+	    c = c.findNextFocusComponent (null);
+	    if (c != null)
+	      return c;
+	  }
+	else if (component[j].isFocusTraversable ())
+	  return component[j];
+      }
+
+    return null;
+  }
 }
Index: java/awt/Panel.java
===================================================================
RCS file: /cvs/gcc/egcs/libjava/java/awt/Panel.java,v
retrieving revision 1.3
diff -u -r1.3 Panel.java
--- Panel.java	2000/12/18 22:17:25	1.3
+++ Panel.java	2001/01/02 23:59:26
@@ -10,16 +10,13 @@
 
 import java.awt.peer.ComponentPeer;
 
-/* An incomplete placeholder. */
+/* This class is complete to 1.2.  */
 
 public class Panel extends Container
 {
   public Panel()
   { 
-    this(
-	 // should be: new FlowLayout()
-	 null // FIXME
-	 );
+    this (new FlowLayout ());
   }
 
   public Panel(LayoutManager layout)
Index: java/awt/ScrollPane.java
===================================================================
RCS file: /cvs/gcc/egcs/libjava/java/awt/ScrollPane.java,v
retrieving revision 1.1
diff -u -r1.1 ScrollPane.java
--- ScrollPane.java	2000/08/03 12:09:38	1.1
+++ ScrollPane.java	2001/01/02 23:59:26
@@ -8,8 +8,340 @@
 
 package java.awt;
 
-/* A very incomplete placeholder. */
+import java.awt.event.AdjustmentListener;
+import java.awt.peer.ScrollPanePeer;
 
+/** A ScrollPane is a component that has vertical and horizontal
+ * scrollbars as well as a single child which is scrolled by them.
+ * @author Tom Tromey <tromey@redhat.com>
+ * @date December 31, 2000
+ * Status: Unfinished.  The Adjustables are probably wrong (there
+ * isn't a mechanism for scrollbar events to affect them), and also
+ * doLayout() is not finished.
+ */
 public class ScrollPane extends Container
 {
+  /** This indicates that scrollbars should only be displayed when
+   * needed.  */
+  public static final int SCROLLBARS_AS_NEEDED = 0;
+  /** This indicates that scrollbars should always be displayed.  */
+  public static final int SCROLLBARS_ALWAYS = 1;
+  /** This indicates that scrollbars should never be displayed.  */
+  public static final int SCROLLBARS_NEVER = 2;
+
+  /** Create a new ScrollPane object using the indicated scrollbar
+   * display policy.  If the policy is not specified it defaults to
+   * SCROLLBARS_AS_NEEDED.  The default size of this component is
+   * 100x100.
+   * @param policy The scrollbar display policy
+   */
+  public ScrollPane ()
+  {
+    this (SCROLLBARS_AS_NEEDED);
+  }
+
+  public ScrollPane (int policy)
+  {
+    if (policy != SCROLLBARS_AS_NEEDED
+	&& policy != SCROLLBARS_ALWAYS
+	&& policy != SCROLLBARS_NEVER)
+      throw new IllegalArgumentException ("invalid value for policy");
+
+    this.policy = policy;
+    setSize (100, 100);
+  }
+
+  /** Add a component to this ScrollPane.
+   * @param comp The component to add
+   * @param constraints Constraints.  This is ignored.
+   * @param pos Position.  This must be <= 0, but is otherwise ignored.
+   */
+  protected final void addImpl (Component comp, Object constraints,
+				int pos)
+  {
+    if (pos > 0)
+      throw new IllegalArgumentException ("pos must be <= 0");
+
+    if (ncomponents > 0)
+      remove (component[0]);
+
+    if (comp.isLightweight ())
+      {
+	Panel p = new Panel ();
+	p.add (comp);
+	comp = p;
+      }
+
+    super.addImpl (comp, constraints, pos);
+  }
+
+  /** This creates the component's peer.  */
+  public void addNotify ()
+  {
+    if (peer == null)
+      peer = getToolkit ().createScrollPane (this);
+    super.addNotify ();
+  }
+
+  /** Lays out the components in this container.  */
+  public void doLayout ()
+  {
+    ScrollPanePeer spp = (ScrollPanePeer) peer;
+    Dimension c = component[0].getPreferredSize ();
+    component[0].setSize (c.width, c.height);
+    spp.childResized (c.width, c.height);
+    // FIXME
+  }
+
+  /** Returns an Adjustable representing the horizontal scrollbar.
+   * The methods setMaximum, setMinimum, and setVisibleAmount should
+   * not be called on this Adjustable.  They will throw AWTError if
+   * called.
+   */
+  public Adjustable getHAdjustable ()
+  {
+    return hscroll;
+  }
+
+  /** Returns the height of the horizontal scrollbar.  */
+  public int getHScrollbarHeight ()
+  {
+    if (peer == null)
+      return 0;
+    ScrollPanePeer spp = (ScrollPanePeer) peer;
+    return spp.getHScrollbarHeight ();
+  }
+
+  /** Returns the scrollbar display policy.  */
+  public int getScrollbarDisplayPolicy ()
+  {
+    return policy;
+  }
+
+  /** Returns the viewport's scroll position.  */
+  public Point getScrollPosition ()
+  {
+    // FIXME
+    return null;
+  }
+
+  /** Returns an Adjustable representing the vertical scrollbar.
+   * The methods setMaximum, setMinimum, and setVisibleAmount should
+   * not be called on this Adjustable.  They will throw AWTError if
+   * called.
+   */
+  public Adjustable getVAdjustable ()
+  {
+    return vscroll;
+  }
+
+  /** Returns the size of the viewport.  */
+  public Dimension getViewportSize ()
+  {
+    Insets ins = getInsets ();
+    int myw = width - ins.left - ins.right;
+    int myh = height - ins.top - ins.bottom;
+
+    Dimension cs;
+    if (ncomponents > 0)
+      cs = component[0].getPreferredSize ();
+    else
+      cs = new Dimension (myw, myh);
+
+    if (policy == SCROLLBARS_ALWAYS
+	|| (policy == SCROLLBARS_AS_NEEDED && myw < cs.width))
+      myw -= getVScrollbarWidth ();
+
+    if (policy == SCROLLBARS_ALWAYS
+	|| (policy == SCROLLBARS_AS_NEEDED && myh < cs.height))
+      myh -= getHScrollbarHeight ();
+
+    // A little optimization -- reuse the Dimension.
+    cs.setSize (myw, myh);
+    return cs;
+  }
+
+  /** Returns the width of the vertical scrollbar.  */
+  public int getVScrollbarWidth ()
+  {
+    if (peer == null)
+      return 0;
+    ScrollPanePeer spp = (ScrollPanePeer) peer;
+    return spp.getVScrollbarWidth ();
+  }
+
+  /** Generates a String representation of this ScrollPane's state.  */
+  public String paramString ()
+  {
+    return ("[" + getClass ().getName ()
+	    + ": " + ((ncomponents > 0) ? component[0].paramString () : "")
+	    + "]");
+  }
+
+  /** Set the layout manager for this component.  ScrollPane has its
+   * own layout manager and overrides this method so that the layout
+   * manager cannot be changed.
+   * @param m The new layout manager (ignored)
+   */
+  public final void setLayout (LayoutManager m)
+  {
+    // Nothing.
+  }
+
+  /** Sets the scroll position for this ScrollPane.  If the point if
+   * out of range it is silently moved within range.
+   * @param x The x coordinate
+   * @param y The y coordinate
+   */
+  public void setScrollPosition (int x, int y)
+  {
+    // According to the JCL we throw a NullPointerException if there
+    // is no child.
+    if (ncomponents == 0)
+      throw new NullPointerException ("no child in ScrollPane");
+
+    Dimension child_d = component[0].getPreferredSize ();
+    Dimension our_d = getViewportSize ();
+
+    int xmax = Math.max (0, child_d.width - our_d.width);
+    int ymax = Math.max (0, child_d.height - our_d.height);
+
+    if (x < 0)
+      x = 0;
+    else if (x > xmax)
+      x = xmax;
+    if (y < 0)
+      y = 0;
+    else if (y > ymax)
+      y = ymax;
+
+    ScrollPanePeer spp = (ScrollPanePeer) peer;
+    spp.setScrollPosition (x, y);
+  }
+
+  /** Sets the scroll position for this ScrollPane.  If the point if
+   * out of range it is silently moved within range.
+   * @param p The new point
+   */
+  public void setScrollPosition (Point p)
+  {
+    setScrollPosition (p.x, p.y);
+  }
+
+  class ScrollPaneAdjustable implements Adjustable
+  {
+    AdjustmentListener listeners;
+    int orient;
+    int unit;
+    int block;
+    int value;
+
+    public ScrollPaneAdjustable (int orient)
+    {
+      this.orient = orient;
+    }
+
+    public void addAdjustmentListener (AdjustmentListener l)
+    {
+      listeners = AWTEventMulticaster.add (listeners, l);
+    }
+
+    public int getBlockIncrement ()
+    {
+      return block;
+    }
+
+    public int getMaximum ()
+    {
+      Dimension child_d = component[0].getPreferredSize ();
+      Dimension our_d = getViewportSize ();
+
+      int xmax = Math.max (0, child_d.width - our_d.width);
+      int ymax = Math.max (0, child_d.height - our_d.height);
+
+      return (orient == Adjustable.HORIZONTAL) ? xmax : ymax;
+    }
+
+    public int getMinimum ()
+    {
+      return 0;
+    }
+
+    public int getOrientation ()
+    {
+      return orient;
+    }
+
+    public int getUnitIncrement ()
+    {
+      return unit;
+    }
+
+    public int getValue ()
+    {
+      return value;
+    }
+
+    public int getVisibleAmount ()
+    {
+      Dimension d = getViewportSize ();
+      return (orient == Adjustable.HORIZONTAL) ? d.width : d.height;
+    }
+
+    public void removeAdjustmentListener (AdjustmentListener l)
+    {
+      listeners = AWTEventMulticaster.remove (listeners, l);
+    }
+
+    public void setBlockIncrement (int b)
+    {
+      block = b;
+      if (peer != null)
+	{
+	  ScrollPanePeer spp = (ScrollPanePeer) peer;
+	  spp.setBlockIncrement (this, b);
+	}
+    }
+
+    public void setMaximum (int max)
+    {
+      throw new AWTError ("can't use setMaximum on this Adjustable");
+    }
+
+    public void setMinimum (int min)
+    {
+      throw new AWTError ("can't use setMinimum on this Adjustable");
+    }
+
+    public void setUnitIncrement (int u)
+    {
+      unit = u;
+      if (peer != null)
+	{
+	  ScrollPanePeer spp = (ScrollPanePeer) peer;
+	  spp.setUnitIncrement (this, u);
+	}
+    }
+
+    public void setValue (int v)
+    {
+      value = v;
+      if (peer != null)
+	{
+	  ScrollPanePeer spp = (ScrollPanePeer) peer;
+	  spp.setValue (this, v);
+	}
+    }
+
+    public void setVisibleAmount (int v)
+    {
+      throw new AWTError ("can't use setVisibleAmount on this Adjustable");
+    }
+  }
+
+  ScrollPaneAdjustable hscroll
+    = new ScrollPaneAdjustable (Adjustable.HORIZONTAL);
+  ScrollPaneAdjustable vscroll
+    = new ScrollPaneAdjustable (Adjustable.VERTICAL);
+  int policy;
 }
Index: java/awt/peer/ComponentPeer.java
===================================================================
RCS file: /cvs/gcc/egcs/libjava/java/awt/peer/ComponentPeer.java,v
retrieving revision 1.6
diff -u -r1.6 ComponentPeer.java
--- ComponentPeer.java	2000/10/11 09:47:25	1.6
+++ ComponentPeer.java	2001/01/02 23:59:26
@@ -30,6 +30,8 @@
   Dimension getMinimumSize();
   Dimension getPreferredSize();
   Toolkit getToolkit();
+  // The JCL says that handleEvent returns boolean.  However, we've
+  // experimentally determined that it in fact actually returns void.
   void handleEvent(AWTEvent e);
   boolean isFocusTraversable();
   void paint(Graphics graphics);
Index: java/awt/peer/ScrollPanePeer.java
===================================================================
RCS file: /cvs/gcc/egcs/libjava/java/awt/peer/ScrollPanePeer.java,v
retrieving revision 1.1
diff -u -r1.1 ScrollPanePeer.java
--- ScrollPanePeer.java	2000/07/12 03:32:07	1.1
+++ ScrollPanePeer.java	2001/01/02 23:59:26
@@ -17,5 +17,6 @@
   int getVScrollbarWidth();
   void setScrollPosition(int x, int y);
   void setUnitIncrement(Adjustable adj, int increment);
+  void setBlockIncrement(Adjustable adj, int increment);
   void setValue(Adjustable adj, int value);
 }


More information about the Java-patches mailing list