Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4185117

ScrollPane.setBackground() sets color of scrollbars on Solaris, not on Windows

XMLWordPrintable

    • x86
    • generic

      gauri.sharma@Eng 1998-10-29
      The behavior of ScrollPane.setBackground() is not consistent
      between Solaris and Windows.
      Invoking setBackground() on a scrollpane causes the background
      color of the scrollpane's scrollbars to be set on Solaris, but
      not on Windows.
      The attached application (ScrollpaneTest.java) sets the background
      color of a scrollpane to pink, and adds a panel to the scrollpane.
      The scrollpane's scrollbars are pink on Solaris, and gray on
      Windows.
      ======================================================================

      JCK awt interactive ScrollPane test failing on WinNT.

      The test case states that the background should be blue and the scrollbars pink, but everything is gray on screen.

      #Test Results
      #Tue Oct 20 16:57:00 PDT 1998
      description=file:Z:/tests/api/java_awt/interactive/SPaneTests.html#ScrollPane
      testsuite=Z:\\tests
      executeArgs=-TestCaseID ALL
      execStatus=Failed. tests: 3; failed: 3; first test case failure: SPaneTest0001
      end=Tue Oct 20 16:57:00 PDT 1998
      work=D:\\o2daikon12aInter\\api\\java_awt\\interactive
      executeClass=javasoft.sqe.tests.api.java.awt.interactive.ScrollPane.SPaneTests
      status=Failed. tests: 3; failed: 3; first test case failure: SPaneTest0001
      keywords=interactive positive runtime
      start=Tue Oct 20 16:56:10 PDT 1998
      title=ScrollPane Interactive Tests
      ObjectID=ScrollPane
      javatestVersion=JT_2.0_zg
      id=ScrollPane
      file=Z:\\tests\\api\\java_awt\\interactive\\SPaneTests.html
      name=ScrollPane
      sections=testExecute testExecute
      environment=jck-runtime-winNT
      source=SPaneTests.java

      test: api\java_awt\interactive\SPaneTests.html#ScrollPane
      script: javasoft.sqe.javatest.lib.JCKScript -runtime
      Executing test class...
      command: javasoft.sqe.javatest.lib.ExecJCKTestOtherJVMCmd CLASSPATH=D:\o2daikon12aInter\classes;Z:\tests\..\classes;Z:\javatest.jar;E:/jdk12o\lib\tools.jar;E:/jdk12o\jre\lib\rt.jar;E:/jdk12o\jre\lib\i18n.jar winDir=C:\winnt SystemRoot=C:\winnt HOME=C:\WINNT\Profiles\madhava PATH=Z:\tests..liblib_winNT E:\jdk12o\bin\java -verify javasoft.sqe.tests.api.java.awt.interactive.ScrollPane.SPaneTests -TestCaseID ALL
      ----------ref:testExecute(3/192)----------
      SPaneTest0001: Failed. Scrollpane does NOT behave as expected.
      SPaneTest0002: Failed. Scrollpane does NOT behave as expected.
      SPaneTest0003: Failed. Scrollpane does NOT behave as expected.
      ----------log:testExecute(1/76)----------
      STATUS:Failed. tests: 3; failed: 3; first test case failure: SPaneTest0001
      command result: Failed. tests: 3; failed: 3; first test case failure: SPaneTest0001
      test result: Failed. tests: 3; failed: 3; first test case failure: SPaneTest0001


      =====================
      Stand-alone test case:

      import java.awt.*;

      public class SPaneTests extends Frame {

         public static void main( String[] argv ) {
            SPaneTests test = new SPaneTests();
            test.setSize(600, 600);
            test.add(new spTester(ScrollPane.SCROLLBARS_AS_NEEDED));
            test.setVisible(true);
         }
      }
      class spTester extends Panel {
        ScrollPane scrollpane = null;

        spTester(int sbPolicy) {
          setLayout(new BorderLayout());
          
          // Create scrollpane
          scrollpane = new ScrollPane(sbPolicy);
          scrollpane.setBackground(new Color(255,122,235));

          // Add button panel to scrollpane
          scrollpane.add(new ButtonPanel(10, 10, 100, 30, 600, 600));
          add(BorderLayout.CENTER, scrollpane);
        }
        
        public Dimension getPreferredSize() {
          return new Dimension(400,400);
        }
      }

      // A panel that contains a grid of buttons
      class ButtonPanel extends Panel {
          Dimension max;
          Dimension prefSize;
       
          public ButtonPanel(int rows, int cols, int unitW, int unitH, int prefWidth, int prefHeight) {
            setLayout(new GridLayout(rows, cols));
            setBackground(new Color(0,255,255));

            int i;
            Button button;
            for(i = 0 ; i < (rows*cols); i++) {
              button = new UnitButton("Button "+i, unitW, unitH);
              add(button);
            }

            max = new Dimension(unitW*cols, unitH*rows);
            prefSize = new Dimension(prefWidth, prefHeight);
          }
       
          public Dimension getPreferredSize() {
            return prefSize;
          }

          public Dimension getMinimumSize() {
            return prefSize;
          }

          public Dimension getMaximumSize() {
            return max;
          }
        }

        class UnitButton extends Button {
          int width, height;
       
          public UnitButton(String label, int w, int h) {
            super(label);
            width = w;
            height = h;
            setSize(w, h);
          }
       
          public Dimension getMinimumSize() {
            return getSize();
          }
       
          public Dimension getPreferredSize() {
            return getSize();
          }
        }

            dmikhalksunw Denis Mikhalkin (Inactive)
            emedinasunw Eve Medina (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: