diff options
author | Michael Koch <konqueror@gmx.de> | 2003-03-18 18:16:54 +0000 |
---|---|---|
committer | Michael Koch <mkoch@gcc.gnu.org> | 2003-03-18 18:16:54 +0000 |
commit | 897db4af51cf3c7abccb0dfa75d957304671c7cf (patch) | |
tree | cfffc936c1690e91c2b2381097e711fbdfd7bb58 /libjava/java/awt | |
parent | 8dfa3bb06ec4c13b185595beefbacf4455979d1f (diff) | |
download | gcc-897db4af51cf3c7abccb0dfa75d957304671c7cf.zip gcc-897db4af51cf3c7abccb0dfa75d957304671c7cf.tar.gz gcc-897db4af51cf3c7abccb0dfa75d957304671c7cf.tar.bz2 |
2003-03-18 Michael Koch <konqueror@gmx.de>
* java/awt/ScrollPane.java
(ScrollPane): Rewrote for new ScrollPaneAdjustable.
(getViewportSize): Likewise.
(addNotify): Likewise.
(removeNotify): Likewise.
* java/awt/ScrollPaneAdjustable.java
(ScrollPaneAdjustable): No longer extends Scrollbar.
* java/beans/beancontext/BeanContextServices.java:
Reformated.
(getService): Added throws TooManyListenersException;
* java/beans/beancontext/BeanContextServicesSupport.java:
Reformated.
From-SVN: r64538
Diffstat (limited to 'libjava/java/awt')
-rw-r--r-- | libjava/java/awt/ScrollPane.java | 41 | ||||
-rw-r--r-- | libjava/java/awt/ScrollPaneAdjustable.java | 10 |
2 files changed, 18 insertions, 33 deletions
diff --git a/libjava/java/awt/ScrollPane.java b/libjava/java/awt/ScrollPane.java index 4ca8e70..930ace7 100644 --- a/libjava/java/awt/ScrollPane.java +++ b/libjava/java/awt/ScrollPane.java @@ -153,8 +153,8 @@ ScrollPane(int scrollbarDisplayPolicy) if (scrollbarDisplayPolicy != SCROLLBARS_NEVER) { - hAdjustable = new ScrollPaneAdjustable(Scrollbar.HORIZONTAL); - vAdjustable = new ScrollPaneAdjustable(Scrollbar.VERTICAL); + hAdjustable = new ScrollPaneAdjustable (this, Scrollbar.HORIZONTAL); + vAdjustable = new ScrollPaneAdjustable (this, Scrollbar.VERTICAL); } wheelScrollingEnabled = true; @@ -215,23 +215,17 @@ getVAdjustable() * * @return The viewport size. */ -public Dimension -getViewportSize() +public Dimension getViewportSize () { - Dimension viewsize = getSize(); - Insets insets = getInsets(); - viewsize.width = viewsize.width - (insets.left + insets.right); - viewsize.height = viewsize.height - (insets.top + insets.bottom); - - ScrollPaneAdjustable v = (ScrollPaneAdjustable)getVAdjustable(); - ScrollPaneAdjustable h = (ScrollPaneAdjustable)getHAdjustable(); - - if ((v != null) && v.isVisible()) - viewsize.width = viewsize.width - v.getSize().width; - if ((h != null) && h.isVisible()) - viewsize.height = viewsize.height - v.getSize().height; - - return(viewsize); + Dimension viewsize = getSize (); + Insets insets = getInsets (); + viewsize.width = (viewsize.width + - (insets.left + insets.right) + - getVScrollbarWidth ()); + viewsize.height = (viewsize.height + - (insets.top + insets.bottom) + - getHScrollbarHeight ()); + return viewsize; } /*************************************************************************/ @@ -347,11 +341,7 @@ addNotify() return; setPeer((ComponentPeer)getToolkit().createScrollPane(this)); - - if (hAdjustable != null) - hAdjustable.addNotify(); - if (vAdjustable != null) - vAdjustable.removeNotify(); + super.addNotify(); } /*************************************************************************/ @@ -362,11 +352,6 @@ addNotify() public void removeNotify() { - if (hAdjustable != null) - hAdjustable.removeNotify(); - if (vAdjustable != null) - vAdjustable.removeNotify(); - super.removeNotify(); } diff --git a/libjava/java/awt/ScrollPaneAdjustable.java b/libjava/java/awt/ScrollPaneAdjustable.java index 2307e59..13131f9 100644 --- a/libjava/java/awt/ScrollPaneAdjustable.java +++ b/libjava/java/awt/ScrollPaneAdjustable.java @@ -49,7 +49,6 @@ import java.io.Serializable; * @since 1.4 */ public class ScrollPaneAdjustable - extends Scrollbar implements Adjustable, Serializable { private static final long serialVersionUID = -3359745691033257079L; @@ -60,13 +59,14 @@ public class ScrollPaneAdjustable int minimum; int maximum; int visibleAmount; - int unitIncrement; - int blockIncrement; + int unitIncrement = 1; + int blockIncrement = 1; AdjustmentListener adjustmentListener; - ScrollPaneAdjustable (int orientation) + ScrollPaneAdjustable (ScrollPane sp, int orientation) { - throw new Error ("not implemented"); + this.sp = sp; + this.orientation = orientation; } ScrollPaneAdjustable (ScrollPane sp, int orientation, int value, int minimum, |