List of usage examples for javax.swing UIManager setLookAndFeel
@SuppressWarnings("deprecation") public static void setLookAndFeel(String className) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException
From source file:EditorPaneExample12.java
public static void main(String[] args) { try {/*from w w w. j a v a2s .c om*/ UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); } catch (Exception evt) { } JFrame f = new EditorPaneExample12(); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent evt) { System.exit(0); } }); f.setSize(500, 400); f.setVisible(true); }
From source file:common.AbstractGUI.java
protected void setUIManager() { try {//from w w w . j av a 2 s. com for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (UnsupportedLookAndFeelException e) { // handle exception } catch (ClassNotFoundException e) { // handle exception } catch (InstantiationException e) { // handle exception } catch (IllegalAccessException e) { // handle exception } }
From source file:io.gameover.utilities.pixeleditor.Pixelizer.java
private void applyLookAndFeel() { try {// w w w .ja v a 2s.co m UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { e.printStackTrace(); } }
From source file:com.brainflow.application.toplevel.Brainflow.java
public void launch() throws Throwable { try {/*from ww w .j ava 2 s . c om*/ String osname = System.getProperty("os.name"); if (osname.toUpperCase().contains("WINDOWS")) { UIManager.setLookAndFeel(new WindowsLookAndFeel()); //UIManager.setLookAndFeel(new com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel()); //LookAndFeelFactory.NimbusInitializer init = new LookAndFeelFactory.NimbusInitializer(); //init.initialize(UIManager.getDefaults()); //UIManager.getDefaults(). LookAndFeelFactory.installJideExtension(); //LookAndFeelFactory.installJideExtension(LookAndFeelFactory.OFFICE2003_STYLE); } else if (osname.toUpperCase().contains("LINUX")) { UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel"); LookAndFeelFactory.installJideExtension(LookAndFeelFactory.XERTO_STYLE); } else { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); LookAndFeelFactory.installJideExtension(); } } catch (UnsupportedLookAndFeelException e) { log.severe("could not load look and feel"); } //final SplashScreen splash = SplashScreen.getSplashScreen(); //JFrame.setDefaultLookAndFeelDecorated(true); long startTime = System.currentTimeMillis(); brainFrame = new BrainFrame(); statusBar = new StatusBar(); reportTime(startTime, "created brainframe"); brainFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); log.info("initializing DisplayManager ..."); DisplayManager.getInstance().createCanvas(); log.info("initializing resources ..."); FutureTask<Boolean> initResources = new FutureTask<Boolean>(new Callable<Boolean>() { public Boolean call() throws Exception { return initializeResources(); } }); threadService.execute(initResources); log.info("loading commands ..."); FutureTask<Boolean> loadCommandsTask = new FutureTask<Boolean>(new Callable<Boolean>() { public Boolean call() throws Exception { return loadCommands(); } }); threadService.execute(loadCommandsTask); log.info("initializing IO ..."); FutureTask<Boolean> initIOTask = new FutureTask<Boolean>(new Callable<Boolean>() { public Boolean call() throws Exception { return initImageIO(); } }); threadService.execute(initIOTask); log.info("initializing status bar ..."); initializeStatusBar(); reportTime(startTime, "initialized status bar"); log.info("initializing work space ..."); initializeWorkspace(); reportTime(startTime, "initialized work space"); loadCommandsTask.get(); reportTime(startTime, "loaded commands"); log.info("binding container ..."); bindContainer(); reportTime(startTime, "bound container"); log.info("initializing tool bar ..."); initializeToolBar(); reportTime(startTime, "initialized tool bar"); log.info("initializing menu ..."); initializeMenu(); reportTime(startTime, "initialized menu"); initIOTask.get(); reportTime(startTime, "initialized IO"); initResources.get(); reportTime(startTime, "initialized resources"); initExceptionHandler(); }
From source file:swing.PrincipalMDI.java
/** * @param args the command line arguments *//* ww w .ja va2 s . c om*/ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { // if ("Nimbus".equals(info.getName())) { // javax.swing.UIManager.setLookAndFeel(info.getClassName()); // break; // } UIManager.setLookAndFeel("de.javasoft.plaf.synthetica.SyntheticaSimple2DLookAndFeel"); } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(PrincipalMDI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(PrincipalMDI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(PrincipalMDI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(PrincipalMDI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new PrincipalMDI().setVisible(true); } }); }
From source file:ch.fork.AdHocRailway.ui.AdHocRailway.java
public AdHocRailway(org.apache.commons.cli.CommandLine parsedCommandLine) { super(TITLE); try {/* www .j av a 2s.c o m*/ appContext = new ApplicationContext(); appContext.getMainBus().register(appContext); appContext.getMainBus().register(this); appContext.setMainApp(this); appContext.setMainFrame(this); setUpLogging(); LOGGER.info("****************************************"); LOGGER.info("AdHoc-Railway starting up!!!"); LOGGER.info("****************************************"); PlasticLookAndFeel.setTabStyle(PlasticLookAndFeel.TAB_STYLE_DEFAULT_VALUE); PlasticLookAndFeel.setHighContrastFocusColorsEnabled(false); UIManager.setLookAndFeel(new PlasticXPLookAndFeel()); splash = new SplashWindow(createImageIconFromCustom("splash.png"), this, 500, 12); setIconImage(createImageIconFromCustom("2-Hot-Train-icon 128.png").getImage()); initProceeded("Loading Persistence Layer (Preferences)"); preferences = Preferences.getInstance(); preferences.loadPreferences(parsedCommandLine.hasOption("c")); appContext.setPreferences(preferences); railwayDeviceManager = new RailwayDeviceManager(appContext); appContext.setRailwayDeviceManager(railwayDeviceManager); railwayDeviceManager.loadControlLayer(); persistenceManager = new PersistenceManager(appContext); persistenceManager.loadPersistenceLayer(); initProceeded("Creating GUI ..."); initGUI(); disableEnableMenuItems(); LOGGER.info("Finished Creating GUI"); splash.setVisible(false); persistenceManager.loadLastFileOrLoadDataFromAdHocServerIfRequested(); updateGUI(); railwayDeviceManager.autoConnectToRailwayDeviceIfRequested(); setSize(1600, 1000); initProceeded("AdHoc-Railway started"); updateCommandHistory("AdHoc-Railway started"); Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { @Override public void uncaughtException(final Thread t, final Throwable e) { handleException(e); } }); setLocationByPlatform(true); setVisible(true); } catch (final Exception e) { handleException(e); } }
From source file:de.unidue.inf.is.ezdl.gframedl.EzDL.java
private static void initDesktopSystem() { RepaintManager.setCurrentManager(new CheckThreadViolationRepaintManager()); Dispatcher.logEventDispatch = false; Dispatcher.logIncomingEvents = false; Dispatcher.logRegistration = false;//from w ww . j ava2 s . c om Dispatcher.logWithThreadInfo = false; JFrame.setDefaultLookAndFeelDecorated(false); JDialog.setDefaultLookAndFeelDecorated(false); I18nSupport.getInstance().init(Config.getInstance().getUserProperty("desktop.language", "en")); try { if (SystemUtils.OS == OperatingSystem.MAC_OS) { System.setProperty("apple.laf.useScreenMenuBar", "true"); } else { checkJavaVersion(); for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } } catch (UnsupportedLookAndFeelException e) { logger.error(e.getMessage(), e); } catch (ClassNotFoundException e) { logger.error(e.getMessage(), e); } catch (InstantiationException e) { logger.error(e.getMessage(), e); } catch (IllegalAccessException e) { logger.error(e.getMessage(), e); } }
From source file:eu.irreality.age.SwingAetheriaGameLoaderInterface.java
public static void setLookAndFeel() { try {/*from w w w . ja v a 2 s .c om*/ boolean setLAF = true; setLAF = false; //pasamos del native look and feel. //check java version and native look and feel: seems that GTK look and feel is broken for versions < 1.6 if (UIManager.getSystemLookAndFeelClassName().indexOf("gtk") >= 0) { String javaVersion = System.getProperty("java.version"); StringTokenizer st = new StringTokenizer(javaVersion, ".-_"); int firstNum; int secondNum; try { firstNum = Integer.valueOf(st.nextToken()).intValue(); secondNum = Integer.valueOf(st.nextToken()).intValue(); /* if ( firstNum <= 1 && secondNum <= 5 ) setLAF = false; */ //don't use GTK l&f at all setLAF = false; } catch (Exception exc) { ; //version unreadable: bah, set the look and feel and pray. } } if (setLAF) { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } } catch (Exception ulafe) { ulafe.printStackTrace(); } }
From source file:EditorPaneExample15.java
public static void main(String[] args) { try {//from w w w . j av a 2 s. co m UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); } catch (Exception evt) { } JFrame f = new EditorPaneExample15(); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent evt) { System.exit(0); } }); f.setSize(500, 400); f.setVisible(true); }
From source file:JDAC.JDAC.java
public static void main(String[] args) { try {/*from w w w . j a v a 2 s.co m*/ UIManager.setLookAndFeel( //UIManager.getSystemLookAndFeelClassName()); UIManager.getCrossPlatformLookAndFeelClassName()); } catch (Exception e) { JOptionPane.showMessageDialog(new Frame(), "" + "Something strange happened\n" + "If the error persists please contact the system administrator\n" + "ERR: theme error"); } JDAC demo = new JDAC(); RefineryUtilities.centerFrameOnScreen(demo); Runnable tmp = new Runnable() { public void run() { System.out.println("JDAC"); System.out.println("Credits: Michele Lizzit - https://lizzit.it/jdac"); searchForPorts(); } }; tmp.run(); }