Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 6u10
    • Fix Version/s: None
    • Component/s: client-libs

      Description

      FULL PRODUCT VERSION :
      java version "1.6.0_10"
      Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
      Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      Synth look and feel merges styles incorrectly. When colors are referenced via idref in synth xml descriptor they are not 'overridden' by colors in styles described later in the same document (see test case below).
      Expected behavior is described here: http://java.sun.com/javase/6/docs/api/javax/swing/plaf/synth/doc-files/synthFileFormat.html#e.bind


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create test case as described in "Source code for an executable test case". Run application, note the color of the text and output line (in standard output).

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The color of the text inside JTextField is blue.
      Output: java.awt.Color[r=0,g=0,b=255]
      ACTUAL -
      The color of the text inside JTextField is red.
      Output: java.awt.Color[r=255,g=0,b=0]

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      Create synth style description file (synth.xml) with following content:

      <synth>
      <style id="Default">
      <font id="FONT_1" name="Arial" style="BOLD" size="11"/>

      <object id="TRACE_RED_COLOR" class="java.awt.Color">
      <int>255</int>
      <int>0</int>
      <int>0</int>
      <int>255</int>
      </object>
      <object id="TRACE_BLUE_COLOR" class="java.awt.Color">
      <int>0</int>
      <int>0</int>
      <int>255</int>
      <int>255</int>
      </object>

      </style>
      <bind style="Default" type="region" key=".*"/>

      <style id="TextField">
              <state value="ENABLED">
                  <color type="TEXT_FOREGROUND" idref="TRACE_RED_COLOR" />
              </state>
      </style>
      <bind style="TextField" type="region" key="TextField"/>

      <style id="teststyle">
      <state value="ENABLED">
      <color type="TEXT_FOREGROUND" idref="TRACE_BLUE_COLOR" />
      </state>
      </style>
      <bind style="teststyle" type="name" key="mytestfield"/>
      </synth>

      Create class Test with following source:
      public class Test {
      public static void main(String[] args) throws UnsupportedLookAndFeelException, ParseException
      {
      SynthLookAndFeel synth = new SynthLookAndFeel();
      synth.load(Test.class.getResourceAsStream("synth.xml"), Test.class);

      UIManager.setLookAndFeel(synth);
      JFrame frame = new JFrame("");
      frame.setSize(300, 300);
      JTextField textField = new JTextField("ABC");
      textField.setName("mytestfield");
      frame.add(textField);

      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.setVisible(true);
      System.out.println(textField.getForeground());
      }
      }

      Note that Test.java and synth.xml must reside in same package
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Use "value" to describe color instead of idref.

        Attachments

          Activity

            People

            • Assignee:
              peterz Peter Zhelezniakov (Inactive)
              Reporter:
              ryeung Roger Yeung (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Imported:
                Indexed: