1

I am trying to implement the Synth look and feel and it is not doing anything to the look of the actual software. My file path is correct as I have checked that. Does anybody know why this is not working:

Java:

try {
    SynthLookAndFeel laf = new SynthLookAndFeel();
    laf.load(new FileInputStream("src/look_and_feel.xml"), Truss.class);
    UIManager.setLookAndFeel(laf);
} catch (Exception e) {         
    e.printStackTrace();
}

XML:

<synth>
    <style id="default">
        <font name="Courier" size="14" />
    </style>
    <bind style="default" type="region" key="Button" />
</synth> 

Thanks in advance.

Alex A
  • 23
  • 8

1 Answers1

1

The recommended way of loading the Look-And-Feel is:

SynthLookAndFeel laf = new SynthLookAndFeel();
laf.load(Truss.class.getResourceAsStream("laf.xml"), Truss.class);
UIManager.setLookAndFeel(laf);

source

Your problem seems to be the way of loading your xml-resource.

Therefore read about the difference of getting the streams here

Additionally take a closer look at the tutorial

Community
  • 1
  • 1
PrR3
  • 1,250
  • 1
  • 18
  • 26
  • I have tried that although Java throws this exception: java.lang.IllegalArgumentException: You must supply an InputStream, StyleFactory and Class or URL – Alex A Aug 19 '14 at 23:54
  • I have made the link work, although the actual XML simply does not do anything! I have even copied and pasted directly from tutorials just to test and nothing works! – Alex A Aug 20 '14 at 01:45