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... :(