Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Synth class produces nothing but white screen??

843806Jun 28 2008 — edited Jun 29 2008
So I'm working throught the examples on the Sun website for learning how to use the Synth class and the associated XML files that go with it. Here is the simple main class that I'm using, basically it just creates a frame and then I add a JScrollBar to it:
public class SynthSample {

  public static void main(String args[]) {

    SynthLookAndFeel synth = new SynthLookAndFeel();

    try {
      
      Class aClass = SynthSample.class;
      InputStream is = aClass.getResourceAsStream("newXMLDocument.xml");
      
      if (is == null) {
        System.err.println("Unable to find theme configuration");
        System.exit(-1);
      }
      
      synth.load(is, aClass);
    } catch (ParseException e) {

        System.err.println("Unable to load theme configuration");
        System.exit(-2);
    }
    
    try {
      
      UIManager.setLookAndFeel(synth);
    } catch (javax.swing.UnsupportedLookAndFeelException e) {
      
        System.err.println("Unable to change look and feel");
        System.exit(-3);
    }
    
    JFrame frame = new JFrame("Synth Sample");
    frame.setLayout(null);
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.setSize(500, 500);
    frame.setVisible(true);
    
    JScrollBar jBar = new JScrollBar();
    jBar.setMaximum(100);
    jBar.setMinimum(0);
    jBar.setEnabled(true);
    jBar.setVisible(true);
    jBar.setLocation(100,100);
    jBar.setSize(20, 100);

    frame.getContentPane().add(jBar);

}}
The XML is even easier.. here it is...
<synth>
  <style id="test">
    <opaque value="true"/>
    <state value="ENABLED">
      <color value="RED" type="FOREGROUND"/>
    </state>
  </style>
  <bind style="test" type="REGION" key="ArrowButton"/>
</synth>
I'm just trying to make the arrow buttons on the scrollbar turn red, that's all. If I comment out the section in a Try/Catch statement then the scrollbar shows up fine. However, once I comment it back in then the window comes up with just white no scrollbar? Any ideas why this is happening? It looks like the xml file is following the expected format, I'm pretty sure, but then again I keep getting nothing... :(
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 27 2008
Added on Jun 28 2008
5 comments
143 views