List of usage examples for javax.swing.plaf.synth SynthLookAndFeel SynthLookAndFeel
public SynthLookAndFeel()
From source file:MainClass.java
public static void main(String args[]) { SynthLookAndFeel synth = new SynthLookAndFeel(); try {//from w ww . j a v a2s.co m Class aClass = MainClass.class; InputStream is = aClass.getResourceAsStream("config.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.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JButton button = new JButton("Hello, Synth"); frame.add(button, BorderLayout.CENTER); JTextField textField = new JTextField(); frame.add(textField, BorderLayout.SOUTH); frame.setSize(300, 200); frame.setVisible(true); }
From source file:SynthApplication.java
private static void initLookAndFeel() { // String lookAndFeel = "com.sun.java.swing.plaf.motif.MotifLookAndFeel"; SynthLookAndFeel lookAndFeel = new SynthLookAndFeel(); try {/*w w w. j a va2s . com*/ lookAndFeel.load(SynthApplication.class.getResourceAsStream(synthFile), SynthApplication.class); UIManager.setLookAndFeel(lookAndFeel); } catch (Exception e) { System.err.println("Couldn't get specified look and feel (" + lookAndFeel + "), for some reason."); System.err.println("Using the default look and feel."); e.printStackTrace(); } }
From source file:lookandfeel.SynthDialog.java
private static void initLookAndFeel() { SynthLookAndFeel lookAndFeel = new SynthLookAndFeel(); try {/*from w ww . jav a 2 s. co m*/ // SynthLookAndFeel load() method throws a checked exception // (java.text.ParseException) so it must be handled lookAndFeel.load(SynthDialog.class.getResourceAsStream("synthDemo.xml"), SynthDialog.class); UIManager.setLookAndFeel(lookAndFeel); } catch (Exception e) { System.err.println("Couldn't get specified look and feel (" + lookAndFeel + "), for some reason."); System.err.println("Using the default look and feel."); e.printStackTrace(); } }
From source file:lookandfeel.SynthDialog.java
private static void initLookAndFeel() { SynthLookAndFeel lookAndFeel = new SynthLookAndFeel(); //w w w . j ava 2 s. c o m try { // SynthLookAndFeel load() method throws a checked exception // (java.text.ParseException) so it must be handled lookAndFeel.load(SynthDialog.class.getResourceAsStream("synthDemo.xml"), SynthDialog.class); UIManager.setLookAndFeel(lookAndFeel); } catch (Exception e) { System.err.println("Couldn't get specified look and feel (" + lookAndFeel + "), for some reason."); System.err.println("Using the default look and feel."); e.printStackTrace(); } }