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

JScrollBar background color is not set in Metal look and feel.

XMLWordPrintable

    • beta
    • sparc
    • solaris_2.6



      Name: nkR10003 Date: 07/14/2000


      Background property is not set to the value stored in the UI defaults table
      ("ScrollBar.background" field) after installation of the Metal look and feel
      on JScrollBar. The program below demonstrates this:

      %java -fullversion
      java full version "1.4.0beta-b22"
      ------------------example--------------------
      // ScrollBarExample.java
      //
      import java.awt.*;
      import java.awt.event.*;
      import javax.swing.*;

      public class ScrollBarExample extends JPanel {
          public ScrollBarExample() {
              super(true);

              setLayout(new BorderLayout());
              UIManager.put("ScrollBar.background", Color.green);
              JScrollBar hbar=new JScrollBar(JScrollBar.HORIZONTAL, 30, 20, 0, 300);
              JScrollBar vbar=new JScrollBar(JScrollBar.VERTICAL, 30, 40, 0, 300);

              hbar.setUnitIncrement(1);
              hbar.setBlockIncrement(5);
              vbar.setUnitIncrement(1);
              vbar.setBlockIncrement(5);
              add(hbar, BorderLayout.SOUTH);
              add(vbar, BorderLayout.EAST);
        }

        public static void main(String s[]) {
          JFrame frame = new JFrame("Scroll Bar Example");
          frame.addWindowListener(new WindowAdapter() {
              public void windowClosing(WindowEvent e) {
                  Window w = e.getWindow();
                  w.setVisible(false);
                  w.dispose();
                  System.exit(0);
              }
          });
          frame.setContentPane(new ScrollBarExample());
          frame.setSize(200,200);
          frame.setVisible(true);
        }
      }
      ---------------------------------------------
      "ScrollBar.background" field in UI defaults table set to green, but scroll bar
      appears with gray background color.

      ======================================================================

            svioletsunw Scott Violet (Inactive)
            knasunw Kna Kna (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: