diff options
author | Mark Wielaard <mark@gcc.gnu.org> | 2006-01-17 18:09:40 +0000 |
---|---|---|
committer | Mark Wielaard <mark@gcc.gnu.org> | 2006-01-17 18:09:40 +0000 |
commit | 2127637945ea6b763966398130e0770fa993c860 (patch) | |
tree | c976ca91e3ef0bda3b34b37c0195145638d8d08e /libjava/classpath/javax/swing/JViewport.java | |
parent | bcb36c3e02e3bd2843aad1b9888513dfb5d6e337 (diff) | |
download | gcc-2127637945ea6b763966398130e0770fa993c860.zip gcc-2127637945ea6b763966398130e0770fa993c860.tar.gz gcc-2127637945ea6b763966398130e0770fa993c860.tar.bz2 |
Imported GNU Classpath 0.20
Imported GNU Classpath 0.20
* Makefile.am (AM_CPPFLAGS): Add classpath/include.
* java/nio/charset/spi/CharsetProvider.java: New override file.
* java/security/Security.java: Likewise.
* sources.am: Regenerated.
* Makefile.in: Likewise.
From-SVN: r109831
Diffstat (limited to 'libjava/classpath/javax/swing/JViewport.java')
-rw-r--r-- | libjava/classpath/javax/swing/JViewport.java | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/libjava/classpath/javax/swing/JViewport.java b/libjava/classpath/javax/swing/JViewport.java index 5f20f0a..debb574 100644 --- a/libjava/classpath/javax/swing/JViewport.java +++ b/libjava/classpath/javax/swing/JViewport.java @@ -38,6 +38,8 @@ exception statement from your version. */ package javax.swing; +import gnu.classpath.SystemProperties; + import java.awt.Component; import java.awt.Dimension; import java.awt.Graphics; @@ -163,7 +165,13 @@ public class JViewport extends JComponent implements Accessible public static final int BACKINGSTORE_SCROLL_MODE = 2; private static final long serialVersionUID = -6925142919680527970L; - + + /** + * The default scrollmode to be used by all JViewports as determined by + * the system property gnu.javax.swing.JViewport.scrollMode. + */ + private static final int defaultScrollMode; + protected boolean scrollUnderway; protected boolean isViewSizeSet; @@ -243,21 +251,26 @@ public class JViewport extends JComponent implements Accessible */ boolean sizeChanged = true; - public JViewport() + /** + * Initializes the default setting for the scrollMode property. + */ + static { - setOpaque(true); String scrollModeProp = - System.getProperty("gnu.javax.swing.JViewport.scrollMode", + SystemProperties.getProperty("gnu.javax.swing.JViewport.scrollMode", "BLIT"); - int myScrollMode; if (scrollModeProp.equalsIgnoreCase("simple")) - myScrollMode = SIMPLE_SCROLL_MODE; + defaultScrollMode = SIMPLE_SCROLL_MODE; else if (scrollModeProp.equalsIgnoreCase("backingstore")) - myScrollMode = BACKINGSTORE_SCROLL_MODE; + defaultScrollMode = BACKINGSTORE_SCROLL_MODE; else - myScrollMode = BLIT_SCROLL_MODE; - setScrollMode(myScrollMode); + defaultScrollMode = BLIT_SCROLL_MODE; + } + public JViewport() + { + setOpaque(true); + setScrollMode(defaultScrollMode); updateUI(); setLayout(createLayoutManager()); lastPaintPosition = new Point(); @@ -410,8 +423,9 @@ public class JViewport extends JComponent implements Accessible public void setView(Component v) { - if (viewListener != null) - getView().removeComponentListener(viewListener); + Component currView = getView(); + if (viewListener != null && currView != null) + currView.removeComponentListener(viewListener); if (v != null) { @@ -772,6 +786,9 @@ public class JViewport extends JComponent implements Accessible */ void paintSimple(Graphics g) { + // We need to call this to properly clear the background. + paintComponent(g); + Point pos = getViewPosition(); Component view = getView(); boolean translated = false; |