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

Setting background color for JSpinner does not work

XMLWordPrintable



      Name: rmT116609 Date: 05/13/2004


      FULL PRODUCT VERSION :
      java version "1.4.2_04"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
      Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Mandrake Linux release 9.2 (FiveStar) for i586
      kernel: 2.4.22-10mdk

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      using KDE 3

      A DESCRIPTION OF THE PROBLEM :
      Setting background color for JSpinner does not work (see the test case).
      Will produce JSpinner with white background (the default color) on my platform.
      using JSpinner.getEditor().setBackground() or JSpinner.setBackground() does not matter.
      Also setForeground(), setFont() seems to be also ignored.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      compile the above code and run spinnerBug file

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      I expect to see a JSpinner with yellow background
      ACTUAL -
      I see JSpinner with white background, the default background color

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.swing.*;
      import java.awt.*;

      class spinnerBug
      {
          public static void main(String args[])
          {
      JFrame frame = new JFrame();

      Container con = frame.getContentPane();

      JSpinner spinner = new JSpinner();
        spinner.getEditor().setBackground(Color.yellow);
      //spinner.setBackground(Color.yellow); // this does not work either
      con.add(spinner);

      frame.setBounds(100, 100, 100, 20);
      frame.setVisible(true);
          }

      }
      ---------- END SOURCE ----------
      (Incident Review ID: 254774)
      ======================================================================

            Unassigned Unassigned
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: