List of usage examples for javax.swing UIManager getCrossPlatformLookAndFeelClassName
public static String getCrossPlatformLookAndFeelClassName()
LookAndFeel
class that implements the default cross platform look and feel -- the Java Look and Feel (JLF). From source file:Main.java
public static void main(String[] args) { try {/*from w w w.j av a 2s . c o m*/ UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); } catch (Exception e) { System.err.println("Look and feel not set."); } JFrame aWindow = new JFrame("This is the Window Title"); aWindow.setBounds(50, 100, 300, 300); aWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); aWindow.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { System.out.println(" " + UIManager.getLookAndFeel().getName()); UIManager.LookAndFeelInfo[] inst = UIManager.getInstalledLookAndFeels(); for (int i = 0; i < inst.length; i++) { System.out.println(" " + inst[i].getName()); }//from w ww .j av a 2s. c om LookAndFeel[] aux = UIManager.getAuxiliaryLookAndFeels(); if (aux != null) { for (int i = 0; i < aux.length; i++) { System.out.println(" " + aux[i].getName()); } } else { System.out.println(" <NONE>"); } System.out.println(" " + UIManager.getCrossPlatformLookAndFeelClassName()); System.out.println(" " + UIManager.getSystemLookAndFeelClassName()); }
From source file:UIManagerDefaults.java
public static void main(String[] args) { System.out.println("Default L&F:"); System.out.println(" " + UIManager.getLookAndFeel().getName()); UIManager.LookAndFeelInfo[] inst = UIManager.getInstalledLookAndFeels(); System.out.println("Installed L&Fs: "); for (int i = 0; i < inst.length; i++) { System.out.println(" " + inst[i].getName()); }//from w w w .j a v a 2s . c o m LookAndFeel[] aux = UIManager.getAuxiliaryLookAndFeels(); System.out.println("Auxiliary L&Fs: "); if (aux != null) { for (int i = 0; i < aux.length; i++) { System.out.println(" " + aux[i].getName()); } } else { System.out.println(" <NONE>"); } System.out.println("Cross-Platform:"); System.out.println(UIManager.getCrossPlatformLookAndFeelClassName()); System.out.println("System:"); System.out.println(UIManager.getSystemLookAndFeelClassName()); System.exit(0); }
From source file:LookAndFeel.java
public static void main(String[] args) { if (args.length == 0) usageError();//from w w w . j av a 2 s . c om if (args[0].equals("cross")) { try { UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); } catch (Exception e) { e.printStackTrace(); } } else if (args[0].equals("system")) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { e.printStackTrace(); } } else if (args[0].equals("motif")) { try { UIManager.setLookAndFeel("com.sun.java." + "swing.plaf.motif.MotifLookAndFeel"); } catch (Exception e) { e.printStackTrace(); } } else usageError(); // Note the look & feel must be set before // any components are created. run(new LookAndFeel(), 300, 200); }
From source file:QandE.Test1.java
public static void main(String[] args) { try {// ww w. j a v a 2 s . co m UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); } catch (Exception e) { } //Create the top-level container and add contents to it. JFrame frame = new JFrame("Test1"); Test1 app = new Test1(); Component contents = app.createComponents(); frame.getContentPane().add(contents, BorderLayout.CENTER); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); }
From source file:TwoStopsGradient.java
public static void main(String... args) { try {/*from ww w .j ava 2 s . c om*/ UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); } catch (IllegalAccessException ex) { ex.printStackTrace(); } catch (InstantiationException ex) { ex.printStackTrace(); } catch (UnsupportedLookAndFeelException ex) { ex.printStackTrace(); } catch (ClassNotFoundException ex) { ex.printStackTrace(); } SwingUtilities.invokeLater(new Runnable() { public void run() { new TwoStopsGradient().setVisible(true); } }); }
From source file:fll.subjective.SubjectiveFrame.java
public static void main(final String[] args) { LogUtils.initializeLogging();//from www .ja v a 2 s .co m Thread.setDefaultUncaughtExceptionHandler(new GuiExceptionHandler()); // Use cross platform look and feel so that things look right all of the // time try { UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); } catch (final ClassNotFoundException e) { LOGGER.warn("Could not find cross platform look and feel class", e); } catch (final InstantiationException e) { LOGGER.warn("Could not instantiate cross platform look and feel class", e); } catch (final IllegalAccessException e) { LOGGER.warn("Error loading cross platform look and feel", e); } catch (final UnsupportedLookAndFeelException e) { LOGGER.warn("Cross platform look and feel unsupported?", e); } try { final SubjectiveFrame frame = new SubjectiveFrame(); frame.addWindowListener(new WindowAdapter() { @Override @SuppressFBWarnings(value = { "DM_EXIT" }, justification = "Exiting from main is OK") public void windowClosing(final WindowEvent e) { System.exit(0); } @Override @SuppressFBWarnings(value = { "DM_EXIT" }, justification = "Exiting from main is OK") public void windowClosed(final WindowEvent e) { System.exit(0); } }); // should be able to watch for window closing, but hidden works frame.addComponentListener(new ComponentAdapter() { @Override @SuppressFBWarnings(value = { "DM_EXIT" }, justification = "Exiting from main is OK") public void componentHidden(final ComponentEvent e) { System.exit(0); } }); GraphicsUtils.centerWindow(frame); frame.setVisible(true); frame.promptForFile(); } catch (final Throwable e) { JOptionPane.showMessageDialog(null, "Unexpected error: " + e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); LOGGER.fatal("Unexpected error", e); System.exit(1); } }
From source file:CelsiusConverter.java
public static void main(String[] args) { // Set the look and feel. try {//w w w . j a v a 2 s .c o m UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); } catch (Exception e) { } CelsiusConverter converter = new CelsiusConverter(); }
From source file:fll.scheduler.SchedulerUI.java
public static void main(final String[] args) { LogUtils.initializeLogging();/*from ww w. ja v a2 s . co m*/ Thread.setDefaultUncaughtExceptionHandler(new GuiExceptionHandler()); // Use cross platform look and feel so that things look right all of the // time try { UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); } catch (final ClassNotFoundException e) { LOGGER.warn("Could not find cross platform look and feel class", e); } catch (final InstantiationException e) { LOGGER.warn("Could not instantiate cross platform look and feel class", e); } catch (final IllegalAccessException e) { LOGGER.warn("Error loading cross platform look and feel", e); } catch (final UnsupportedLookAndFeelException e) { LOGGER.warn("Cross platform look and feel unsupported?", e); } try { final SchedulerUI frame = new SchedulerUI(); frame.addWindowListener(new WindowAdapter() { @Override @SuppressFBWarnings(value = { "DM_EXIT" }, justification = "Exiting from main is OK") public void windowClosing(final WindowEvent e) { System.exit(0); } @Override @SuppressFBWarnings(value = { "DM_EXIT" }, justification = "Exiting from main is OK") public void windowClosed(final WindowEvent e) { System.exit(0); } }); // should be able to watch for window closing, but hidden works frame.addComponentListener(new ComponentAdapter() { @Override @SuppressFBWarnings(value = { "DM_EXIT" }, justification = "Exiting from main is OK") public void componentHidden(final ComponentEvent e) { System.exit(0); } }); GraphicsUtils.centerWindow(frame); frame.setVisible(true); } catch (final Exception e) { LOGGER.fatal("Unexpected error", e); JOptionPane.showMessageDialog(null, "An unexpected error occurred. Please send the log file and a description of what you were doing to the developer. Error message: " + e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } }
From source file:CelsiusConverter2.java
public static void main(String[] args) { // set the look and feel try {//from www . ja v a 2 s .c o m UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); } catch (Exception e) { } CelsiusConverter2 converter = new CelsiusConverter2(); }