diff options
author | Tom Tromey <tromey@redhat.com> | 2001-01-03 20:34:44 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2001-01-03 20:34:44 +0000 |
commit | 234fb86caebe5e54a9bc0dc9d39ffe54d83892b0 (patch) | |
tree | 2223af0e5c6d30c4d38f4c9c3990b194320cbe3c /libjava/java | |
parent | 6bfa3dac7441079857a8b171803c7520adeaf6d5 (diff) | |
download | gcc-234fb86caebe5e54a9bc0dc9d39ffe54d83892b0.zip gcc-234fb86caebe5e54a9bc0dc9d39ffe54d83892b0.tar.gz gcc-234fb86caebe5e54a9bc0dc9d39ffe54d83892b0.tar.bz2 |
ScrollPane.java (setBlockIncrement): Throw error.
* java/awt/ScrollPane.java (setBlockIncrement): Throw error.
(getViewportSize): Insets include scrollbar size.
(doLayout): Finished.
(getScrollPosition): Wrote.
* java/awt/peer/ScrollPanePeer.java (setBlockIncrement): Removed.
From-SVN: r38670
Diffstat (limited to 'libjava/java')
-rw-r--r-- | libjava/java/awt/ScrollPane.java | 33 | ||||
-rw-r--r-- | libjava/java/awt/peer/ScrollPanePeer.java | 1 |
2 files changed, 13 insertions, 21 deletions
diff --git a/libjava/java/awt/ScrollPane.java b/libjava/java/awt/ScrollPane.java index 69edf81..dd657ac 100644 --- a/libjava/java/awt/ScrollPane.java +++ b/libjava/java/awt/ScrollPane.java @@ -15,9 +15,6 @@ import java.awt.peer.ScrollPanePeer; * 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 { @@ -90,7 +87,8 @@ public class ScrollPane extends Container Dimension c = component[0].getPreferredSize (); component[0].setSize (c.width, c.height); spp.childResized (c.width, c.height); - // FIXME + // Update the scrollbar position to the closest valid value. + setScrollPosition (hscroll.getValue (), vscroll.getValue ()); } /** Returns an Adjustable representing the horizontal scrollbar. @@ -121,8 +119,7 @@ public class ScrollPane extends Container /** Returns the viewport's scroll position. */ public Point getScrollPosition () { - // FIXME - return null; + return new Point (hscroll.getValue (), vscroll.getValue ()); } /** Returns an Adjustable representing the vertical scrollbar. @@ -138,6 +135,9 @@ public class ScrollPane extends Container /** Returns the size of the viewport. */ public Dimension getViewportSize () { + // Note: according to the online docs, the Insets are + // automatically updated by the peer to include the scrollbar + // sizes. Insets ins = getInsets (); int myw = width - ins.left - ins.right; int myh = height - ins.top - ins.bottom; @@ -148,14 +148,6 @@ public class ScrollPane extends Container 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; @@ -228,6 +220,12 @@ public class ScrollPane extends Container setScrollPosition (p.x, p.y); } + // This implements the Adjustable for each scrollbar. The + // expectation is that the peer will look at these objects directly + // and modify the values in them when the user manipulates the + // scrollbars. This has to be done from CNI to bypass Java + // protection rules. The peer should also take care of calling the + // adjustment listeners. class ScrollPaneAdjustable implements Adjustable { AdjustmentListener listeners; @@ -295,12 +293,7 @@ public class ScrollPane extends Container public void setBlockIncrement (int b) { - block = b; - if (peer != null) - { - ScrollPanePeer spp = (ScrollPanePeer) peer; - spp.setBlockIncrement (this, b); - } + throw new AWTError ("can't use setBlockIncrement on this Adjustable"); } public void setMaximum (int max) diff --git a/libjava/java/awt/peer/ScrollPanePeer.java b/libjava/java/awt/peer/ScrollPanePeer.java index 0fcf44d..fe300e4 100644 --- a/libjava/java/awt/peer/ScrollPanePeer.java +++ b/libjava/java/awt/peer/ScrollPanePeer.java @@ -17,6 +17,5 @@ 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); } |