Hi John,
I too have been working w/ Synth, but have a much more basic problem than you do. I keep getting the error below about not supplying an InputStream, even though I have supplied one.
Unable to find theme configuration
Exception: You must supply an InputStream;, Class and StyleFactory
java.lang.IllegalArgumentException: You must supply an InputStream;, Class and S
tyleFactory
at javax.swing.plaf.synth.SynthParser.parse(Unknown Source)
at javax.swing.plaf.synth.SynthLookAndFeel.load(Unknown Source)
at gov.nasa.jsc.console.MyClass$2.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
The InputStream is null and my only guess is that it can’t find my XML file. I have the file ‘MyClass’ in a jar and the XML is not in the jar. Does the code below look right? Do I have to do something else to get a resource stream if ‘MyClass’ is in a jar or should I be able to grab the resource stream as is?
Any help much appreciated.
— synth code
Runnable runner = new Runnable() {
public void run() {
try {
SynthLookAndFeel synth = new SynthLookAndFeel();
Class aClass = MyClass.class;
InputStream is = aClass.getResourceAsStream("bin"
+ System.getProperty("file.separator") + "mylaf.xml");
if (is == null) {
System.err.println("Unable to find theme configuration");
}
synth.load(is, aClass);
UIManager.setLookAndFeel(synth);
} catch (ParseException pe) {
System.err.println("Unable to load theme configuration");
} catch (UnsupportedLookAndFeelException ulafe) {
System.err.println("Unable to change look and feel");
} catch (Exception e) {
System.err.println("Exception: " + e.getMessage());
e.printStackTrace();
}
}
};
EventQueue.invokeLater(runner);