aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2001-01-03 00:07:13 +0000
committerTom Tromey <tromey@gcc.gnu.org>2001-01-03 00:07:13 +0000
commitf5826791be275f1e34269e52a93d4386216f9556 (patch)
treec665509a1b1611aeb1f349ca2a85c0c68223e494
parent4f78b9a896ea942d9241538d15532b8f1587f420 (diff)
downloadgcc-f5826791be275f1e34269e52a93d4386216f9556.zip
gcc-f5826791be275f1e34269e52a93d4386216f9556.tar.gz
gcc-f5826791be275f1e34269e52a93d4386216f9556.tar.bz2
ScrollPane.java: Wrote.
* 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. From-SVN: r38639
-rw-r--r--libjava/ChangeLog27
-rw-r--r--libjava/java/awt/Component.java177
-rw-r--r--libjava/java/awt/Container.java97
-rw-r--r--libjava/java/awt/Panel.java7
-rw-r--r--libjava/java/awt/ScrollPane.java334
-rw-r--r--libjava/java/awt/peer/ComponentPeer.java2
-rw-r--r--libjava/java/awt/peer/ScrollPanePeer.java1
7 files changed, 547 insertions, 98 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 551c2e68..e3247e3 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,30 @@
+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.
+
2000-12-30 Bryce McKinlay <bryce@albatross.co.nz>
* Makefile.am (libgcj_la_LIBADD): Add $(THREADLIBS). This ensures that
diff --git a/libjava/java/awt/Component.java b/libjava/java/awt/Component.java
index da5106e..6bca20d 100644
--- a/libjava/java/awt/Component.java
+++ b/libjava/java/awt/Component.java
@@ -205,13 +205,10 @@ public abstract class Component implements ImageObserver, MenuContainer,
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 abstract class Component implements ImageObserver, MenuContainer,
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 abstract class Component implements ImageObserver, MenuContainer,
public Dimension getPreferredSize()
{
- // FIXME?
if (peer == null)
return new Dimension(width, height);
else
@@ -575,7 +574,6 @@ public abstract class Component implements ImageObserver, MenuContainer,
public Dimension getMinimumSize()
{
- // FIXME?
if (peer == null)
return new Dimension(width, height);
else
@@ -587,24 +585,22 @@ public abstract class Component implements ImageObserver, MenuContainer,
{
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 @@ public abstract class Component implements ImageObserver, MenuContainer,
valid = false;
if ((parent != null) && parent.valid)
- parent.invalidate ();
+ parent.invalidate ();
}
-
+
public Graphics getGraphics()
{
if (peer != null)
@@ -713,40 +709,41 @@ public abstract class Component implements ImageObserver, MenuContainer,
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 @@ public abstract class Component implements ImageObserver, MenuContainer,
// 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 @@ public abstract class Component implements ImageObserver, MenuContainer,
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 @@ public abstract class Component implements ImageObserver, MenuContainer,
v.copyInto(el_a);
return el_a;
}
-
+
static void getListenerList(EventListener el, Vector v)
{
if (el instanceof AWTEventMulticaster)
@@ -1040,7 +1038,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
// /** @since 1.2 */
//
// public InputContext getInputContext()
-
+
protected final void enableEvents(long eventsToEnable)
{
eventMask |= eventsToEnable;
@@ -1054,14 +1052,16 @@ public abstract class Component implements ImageObserver, MenuContainer,
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 abstract class Component implements ImageObserver, MenuContainer,
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 @@ public abstract class Component implements ImageObserver, MenuContainer,
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 @@ public abstract class Component implements ImageObserver, MenuContainer,
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;
diff --git a/libjava/java/awt/Container.java b/libjava/java/awt/Container.java
index aa16a8f..595c6bf 100644
--- a/libjava/java/awt/Container.java
+++ b/libjava/java/awt/Container.java
@@ -119,7 +119,7 @@ public class Container extends Component
if (peer != null)
{
comp.addNotify ();
-
+
if (comp.isLightweight())
enableEvents(comp.eventMask);
}
@@ -127,7 +127,7 @@ public class Container extends Component
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 @@ public class Container extends Component
{
return layoutMgr;
}
-
+
public void setLayout(LayoutManager mgr)
{
layoutMgr = mgr;
- // FIXME
+ invalidate ();
}
-
+
public void doLayout()
{
if (layoutMgr != null)
@@ -496,7 +496,7 @@ public class Container extends Component
// 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 @@ public class Container extends Component
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 class Container extends Component
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 class Container extends Component
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;
+ }
}
diff --git a/libjava/java/awt/Panel.java b/libjava/java/awt/Panel.java
index 8719695..672caf9 100644
--- a/libjava/java/awt/Panel.java
+++ b/libjava/java/awt/Panel.java
@@ -10,16 +10,13 @@ package java.awt;
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)
diff --git a/libjava/java/awt/ScrollPane.java b/libjava/java/awt/ScrollPane.java
index 2c3454c..69edf81 100644
--- a/libjava/java/awt/ScrollPane.java
+++ b/libjava/java/awt/ScrollPane.java
@@ -8,8 +8,340 @@ details. */
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;
}
diff --git a/libjava/java/awt/peer/ComponentPeer.java b/libjava/java/awt/peer/ComponentPeer.java
index 9e114fc..6a587a2 100644
--- a/libjava/java/awt/peer/ComponentPeer.java
+++ b/libjava/java/awt/peer/ComponentPeer.java
@@ -30,6 +30,8 @@ public interface ComponentPeer
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);
diff --git a/libjava/java/awt/peer/ScrollPanePeer.java b/libjava/java/awt/peer/ScrollPanePeer.java
index fe300e4..0fcf44d 100644
--- a/libjava/java/awt/peer/ScrollPanePeer.java
+++ b/libjava/java/awt/peer/ScrollPanePeer.java
@@ -17,5 +17,6 @@ public interface ScrollPanePeer extends ContainerPeer
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);
}