[kaffe] CVS kaffe (robilad): Resynced with GNU Classpath: basic plaf fixes

Kaffe CVS cvs-commits at kaffe.org
Fri Apr 22 16:51:46 PDT 2005


PatchSet 5742 
Date: 2005/04/22 23:45:10
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: basic plaf fixes

2005-04-22  Dalibor Topic  <robilad at kaffe.org>

        Resynced with GNU Classpath:

        2005-04-18  Roman Kennke  <roman at kennke.org>

        * javax/swing/plaf/basic/BasicScrollBarUI.java
        (installUI): Install listeners after everything all, otherwise
        we get strange NPEs in some situations, especially with
        custom L&Fs.
        (createIncreaseButton): Orientation is expected to be
        SwingConstants.NORTH, ..SOUTH, ..WEST or ..EAST and not
        HORIZONTAL or VERTICAL.
        (createDecreaseButton): Orientation is expected to be
        SwingConstants.NORTH, ..SOUTH, ..WEST or ..EAST and not
        HORIZONTAL or VERTICAL.
        (installComponents): Orientation for buttons is expected to be
        SwingConstants.NORTH, ..SOUTH, ..WEST or ..EAST and not
        HORIZONTAL or VERTICAL.

Members: 
	ChangeLog:1.3910->1.3911 
	libraries/javalib/javax/swing/plaf/basic/BasicScrollBarUI.java:1.8->1.9 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3910 kaffe/ChangeLog:1.3911
--- kaffe/ChangeLog:1.3910	Fri Apr 22 23:38:24 2005
+++ kaffe/ChangeLog	Fri Apr 22 23:45:10 2005
@@ -2,6 +2,26 @@
 
 	Resynced with GNU Classpath:
 
+	2005-04-18  Roman Kennke  <roman at kennke.org>
+
+        * javax/swing/plaf/basic/BasicScrollBarUI.java
+        (installUI): Install listeners after everything all, otherwise
+        we get strange NPEs in some situations, especially with
+        custom L&Fs.
+        (createIncreaseButton): Orientation is expected to be
+        SwingConstants.NORTH, ..SOUTH, ..WEST or ..EAST and not
+        HORIZONTAL or VERTICAL.
+        (createDecreaseButton): Orientation is expected to be
+        SwingConstants.NORTH, ..SOUTH, ..WEST or ..EAST and not
+        HORIZONTAL or VERTICAL.
+        (installComponents): Orientation for buttons is expected to be
+        SwingConstants.NORTH, ..SOUTH, ..WEST or ..EAST and not
+        HORIZONTAL or VERTICAL.
+
+2005-04-22  Dalibor Topic  <robilad at kaffe.org>
+
+	Resynced with GNU Classpath:
+
 	2005-04-18  Jeroen Frijters  <jeroen at frijters.net>
 
         * java/nio/ByteBufferImpl.java (get(), put(byte)): Inlined checks
Index: kaffe/libraries/javalib/javax/swing/plaf/basic/BasicScrollBarUI.java
diff -u kaffe/libraries/javalib/javax/swing/plaf/basic/BasicScrollBarUI.java:1.8 kaffe/libraries/javalib/javax/swing/plaf/basic/BasicScrollBarUI.java:1.9
--- kaffe/libraries/javalib/javax/swing/plaf/basic/BasicScrollBarUI.java:1.8	Thu Jan 27 14:07:12 2005
+++ kaffe/libraries/javalib/javax/swing/plaf/basic/BasicScrollBarUI.java	Fri Apr 22 23:45:17 2005
@@ -152,8 +152,18 @@
         {
 	  incrButton.removeMouseListener(buttonListener);
 	  decrButton.removeMouseListener(buttonListener);
-	  incrButton = createIncreaseButton(scrollbar.getOrientation());
-	  decrButton = createDecreaseButton(scrollbar.getOrientation());
+          int orientation = scrollbar.getOrientation();
+          switch (orientation)
+            {
+            case (JScrollBar.HORIZONTAL):
+              incrButton = createIncreaseButton(EAST);
+              decrButton = createDecreaseButton(WEST);
+              break;
+            case (JScrollBar.VERTICAL):
+              incrButton = createIncreaseButton(SOUTH);
+              decrButton = createDecreaseButton(NORTH);
+              break;
+            }
 	  incrButton.addMouseListener(buttonListener);
 	  decrButton.addMouseListener(buttonListener);
 	  calculatePreferredSize();
@@ -513,16 +523,9 @@
   protected JButton createIncreaseButton(int orientation)
   {
     if (incrButton == null)
-      incrButton = new BasicArrowButton((orientation == SwingConstants.HORIZONTAL)
-                                        ? SwingConstants.EAST
-                                        : SwingConstants.SOUTH);
+      incrButton = new BasicArrowButton(orientation);
     else
-      {
-	if (orientation == SwingConstants.HORIZONTAL)
-	  ((BasicArrowButton) incrButton).setDirection(SwingConstants.EAST);
-	else
-	  ((BasicArrowButton) incrButton).setDirection(SwingConstants.SOUTH);
-      }
+      ((BasicArrowButton) incrButton).setDirection(orientation);
     return incrButton;
   }
 
@@ -537,16 +540,9 @@
   protected JButton createDecreaseButton(int orientation)
   {
     if (decrButton == null)
-      decrButton = new BasicArrowButton((orientation == SwingConstants.HORIZONTAL)
-                                        ? SwingConstants.WEST
-                                        : SwingConstants.NORTH);
+      decrButton = new BasicArrowButton(orientation);
     else
-      {
-	if (orientation == SwingConstants.HORIZONTAL)
-	  ((BasicArrowButton) decrButton).setDirection(SwingConstants.WEST);
-	else
-	  ((BasicArrowButton) decrButton).setDirection(SwingConstants.NORTH);
-      }
+      ((BasicArrowButton) decrButton).setDirection(orientation);
     return decrButton;
   }
 
@@ -793,9 +789,19 @@
    */
   protected void installComponents()
   {
-    incrButton = createIncreaseButton(scrollbar.getOrientation());
+    int orientation = scrollbar.getOrientation();
+    switch (orientation)
+      {
+      case (JScrollBar.HORIZONTAL):
+        incrButton = createIncreaseButton(EAST);
+        decrButton = createDecreaseButton(WEST);
+        break;
+      case (JScrollBar.VERTICAL):
+        incrButton = createIncreaseButton(SOUTH);
+        decrButton = createDecreaseButton(NORTH);
+        break;
+      }
     scrollbar.add(incrButton);
-    decrButton = createDecreaseButton(scrollbar.getOrientation());
     scrollbar.add(decrButton);
   }
 
@@ -869,9 +875,9 @@
 	scrollTimer.setRepeats(true);
 
 	installComponents();
-	installListeners();
 	installDefaults();
 	configureScrollBarColors();
+	installListeners();
 
 	calculatePreferredSize();
 	layoutContainer(scrollbar);




More information about the kaffe mailing list