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:net.technicpack.launcher.LauncherMain.java
public static void main(String[] args) { try {//from w ww .j a va 2 s . c o m UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception ex) { Utils.getLogger().log(Level.SEVERE, ex.getMessage(), ex); } StartupParameters params = new StartupParameters(args); try { new JCommander(params, args); } catch (Exception ex) { ex.printStackTrace(); } Relauncher launcher = new Relauncher( new HttpUpdateStream("http://beta.technicpack.net/api/launcher/version/")); TechnicSettings settings = null; try { settings = SettingsFactory.buildSettingsObject(launcher.getRunningPath(LauncherMain.class), params.isMover()); } catch (UnsupportedEncodingException ex) { ex.printStackTrace(); } if (settings == null) { ResourceLoader installerResources = new ResourceLoader("net", "technicpack", "launcher", "resources"); installerResources.setLocale(ResourceLoader.DEFAULT_LOCALE); InstallerFrame dialog = new InstallerFrame(installerResources, params); dialog.setVisible(true); return; } LauncherDirectories directories = new TechnicLauncherDirectories(settings.getTechnicRoot()); ResourceLoader resources = new ResourceLoader("net", "technicpack", "launcher", "resources"); resources.setLocale(settings.getLanguageCode()); setupLogging(directories, resources); boolean needsReboot = false; if (System.getProperty("awt.useSystemAAFontSettings") == null || !System.getProperty("awt.useSystemAAFontSettings").equals("lcd")) needsReboot = true; else if (!Boolean.parseBoolean(System.getProperty("java.net.preferIPv4Stack"))) needsReboot = true; if (params.isLauncher()) startLauncher(settings, params, directories, resources); else if (params.isMover()) startMover(params, launcher); else if (needsReboot && StringUtils.isNumeric(resources.getLauncherBuild())) { // ^^^^^ //The debugger can't really relaunch so double check the build number to make sure we're operating in a valid environment launcher.launch(null, LauncherMain.class, params.getArgs()); return; } else { updateAndRelaunch(params, directories, resources, settings, launcher); } }
From source file:net.ytbolg.mcxa.MCLaucherXA.java
/** * @param args the command line arguments * @throws java.lang.Exception//from ww w . j a v a2s. c o m */ public static void main(String args[]) throws InterruptedException { //System.out.println(System.getProperty("os.name")); //Test.main(null); System.out.println(System.getProperty("os.arch")); // System.getProperties().list(System.out); try { String tx = new File(".").getCanonicalPath(); if (tx.endsWith("\\")) { tx = tx.substring(0, tx.length() - 1); } File f2 = new File(tx + "/update.note"); System.out.println(f2.exists() + f2.toString()); if (f2.exists()) { // Thread.sleep(3000); String x = ReadFile(f2.toString()); System.out.println(x); f2.deleteOnExit(); new File(x).delete(); } UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); // Test t = new Test("H:\\mclaucherxa\\"); // t.countJavaFile(t.projectPath); GameInfo.tpf = getTpf(); // GameInfo.JavaPath = "java"; String fgf = System.getProperty("os.name").contains("Linux") ? "'" : "\""; if (!System.getProperty("os.name").contains("Windows")) { // GameInfo.JavaPath = "java"; GameInfo.JavaPath = System.getProperty("java.home") + tpf + "bin" + tpf + "java"; } else { // GameInfo.JavaPath = "java"; GameInfo.JavaPath = System.getProperty("java.home") + tpf + "bin" + tpf + "java.exe"; } // GameInfo.GameDir = "J:\\NewZM\\client\\.minecraft"; // GameInfoGet.getGameVersions(); GameInfo.Rundir = new File(".").getCanonicalPath(); System.out.println(GameInfo.Rundir); if (GameInfo.Rundir.endsWith("\\")) { GameInfo.Rundir = GameInfo.Rundir.substring(0, GameInfo.Rundir.length() - 1); } System.out.println(GameInfo.Rundir); GameInfo.GameDir = GameInfo.Rundir + GameInfo.tpf + ".minecraft"; //?? String Files[] = { "sChinese.lang", "tChinese.lang", "English.lang" }; String Langs[] = { LangFile.sChinese, LangFile.tChinese, LangFile.english }; ArrayList<File> file = new ArrayList<>(); for (int i = 0; i < Files.length; i++) { File f = new File(GameInfo.Rundir + tpf + "MCXA.Lang" + tpf + Files[i]); File par = f.getParentFile(); if (par.isFile() || !par.exists()) { par.mkdir(); } System.out.println(f); if (!f.exists()) { f.createNewFile(); file.add(f); } } for (int i = 0; i < file.size(); i++) { FileWriter fw = new FileWriter(file.get(i)); fw.write(Langs[i]); fw.close(); } // getClass().getResource("/sChinese.lang"). if (!(new File(GameInfo.Rundir + tpf + "MCXA.json")).exists()) { System.out.println("?"); new File(GameInfo.Rundir + tpf + "MCXA.json").createNewFile(); FileWriter fw = new FileWriter(GameInfo.Rundir + tpf + "MCXA.json"); fw.write("{}"); fw.close(); // p.load(new FileInputStream(GameInfo.Rundir + tpf + "MCXA.cfg")); String playerxxx = String.valueOf(new Random().nextInt(999)); if (playerxxx.length() != 3) { for (int i = 1; i < playerxxx.length() - 1; i++) { playerxxx = "0" + playerxxx; } } Config.Load(new File(GameInfo.Rundir + tpf + "MCXA.json")); Config.setConfig("username", "player" + playerxxx); Config.setConfig("lastgameversion", "0"); Config.setConfig("lastmemory", "1500"); // Config.setConfig("showlauchinfowindows", "true"); Config.setConfig("showlauchinfo", "true"); Config.setConfig("ifclose", "true"); Config.setConfig("zhengbanmima", ""); Config.setConfig("DownSou", "1"); Config.setConfig("Lang", "sChinese.lang"); Config.setConfig("iszhengban", "false"); Config.setConfig("GameDir", GameInfo.GameDir); Config.setConfig("JavaPath", GameInfo.JavaPath); Config.setConfig("isDuli", "false"); Config.Save(); } else { Config.Load(new File(GameInfo.Rundir + tpf + "MCXA.json")); } GameInfo.GameDir = Config.getConfig("GameDir"); if (new File(GameInfo.GameDir).exists() == false) { Config.setConfig("GameDir", GameInfo.Rundir + tpf + ".minecraft"); GameInfo.GameDir = Config.getConfig("GameDir"); Config.Save(); } GameInfo.JavaPath = Config.getConfig("JavaPath"); Lang.Load(new File(GameInfo.Rundir + tpf + "MCXA.Lang" + tpf + Config.getConfig("Lang"))); // // p.load(new FileInputStream(GameInfo.Rundir + tpf + "MCXA.cfg")); //p.store(new FileOutputStream(GameInfo.Rundir + tpf + "MCXA.cfg"), ""); /* 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; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(MCLaucherXA.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(MCLaucherXA.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(MCLaucherXA.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(MCLaucherXA.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); }*/ //</editor-fold> //System.getProperties().list(System.out); /* Create and display the form */ if (!new File(GameInfo.GameDir).exists()) { JOptionPane.showMessageDialog(null, Lang.getLang("Main_NoMinecraftDir")); File fi = new File(GameInfo.GameDir + GameInfo.tpf + "versions"); fi.mkdirs(); // System.exit(0); } java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new MCLaucherXA().setVisible(true); } }); } catch (HeadlessException | IOException | ClassNotFoundException | IllegalAccessException | InstantiationException | UnsupportedLookAndFeelException e) { e.printStackTrace(); } }
From source file:nl.tudelft.goal.SimpleIDE.SimpleIDE.java
/** * Sets look and feel. Gets preference settings from * {@link GUIandFilePreferencePanel}.// w w w. j ava2 s .co m */ private void setLookAndFeel() { if (IDEPreferences.getLAF().equals("Nimbus")) { //$NON-NLS-1$ try { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { //$NON-NLS-1$ UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (Exception e) { new Warning(Resources.get(WarningStrings.FAILED_LAF_NIMBUS), e); } } UIManager.put("TextArea.font", UIManager.getFont("TextArea.font") //$NON-NLS-1$ //$NON-NLS-2$ .deriveFont((float) IDEPreferences.getConsoleFontSize())); }
From source file:nz.co.fortytwo.freeboard.installer.InstalManager.java
public static void main(String[] args) { System.out.println("Current dir:" + new File(".").getAbsolutePath()); try {//from ww w . j a v a 2 s. com for (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 } EventQueue.invokeLater(new Runnable() { public void run() { new InstalManager("FreeBoard - Install Manager").setVisible(true); } }); }
From source file:nz.govt.natlib.ndha.manualdeposit.App.java
public static void main(final String[] args) { LOG.debug("Starting Indigo Application"); try {/*from w w w . j a v a2s . co m*/ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception ex) { LOG.error("Error setting look and feel", ex); } if ((args.length > 0) && (args[0] != null) && ((args[0].equalsIgnoreCase("metadata")) || (args[0].equalsIgnoreCase("/metadata")))) { final IMetaDataConfigurator configurator = new MetaDataConfigurator(); final MetaDataConfiguratorPresenter presenter = new MetaDataConfiguratorPresenter(configurator); configurator.setPresenter(presenter); presenter.setup(); } else { final IManualDepositMainFrame deposit = new ManualDepositMain(); AppProperties appProperties = null; try { appProperties = new AppProperties(); } catch (Exception ex) { final String message = "Error loading application properties - " + ex.getMessage(); LOG.error(message, ex); JOptionPane.showMessageDialog(null, message, "Error Loading Application Properties", JOptionPane.ERROR_MESSAGE); System.exit(-1); } final ILoginView login = new Login(null, true, appProperties.getApplicationData().getSettingsPath()); try { final LoginPresenter loginPresenter = new LoginPresenter(login, appProperties); final ManualDepositPresenter presenter = new ManualDepositPresenter(deposit, login, loginPresenter, appProperties); deposit.setPresenter(presenter); presenter.setupScreen(); } catch (Exception ex) { LOG.error("Error running Indigo", ex); JOptionPane.showMessageDialog(null, ex.getMessage(), "Error running Indigo", JOptionPane.ERROR_MESSAGE); System.exit(-1); } } }
From source file:ome.formats.importer.gui.FileQueueChooser.java
/** * Main for testing (debugging only)/*from ww w . ja v a 2 s . c o m*/ * * @param args * @throws Exception */ public static void main(String[] args) { String laf = UIManager.getSystemLookAndFeelClassName(); //laf = "ch.randelshofer.quaqua.QuaquaLookAndFeel"; //laf = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel"; //laf = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"; //laf = "com.sun.java.swing.plaf.motif.MotifLookAndFeel"; //laf = "javax.swing.plaf.metal.MetalLookAndFeel"; System.err.println(laf); try { UIManager.setLookAndFeel(laf); } catch (Exception e) { System.err.println(laf + " not supported."); } System.err.println("laf: " + UIManager.getLookAndFeel()); FileQueueChooser c = new FileQueueChooser(null, null); JFrame f = new JFrame(); c.setMultiSelectionEnabled(true); f.getContentPane().add(c); f.setVisible(true); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.pack(); }
From source file:ome.formats.importer.gui.FileQueueTable.java
/** * Main for testing (debugging only)// w w w. ja v a 2 s. c o m * * @param args * @throws Exception */ public static void main(String[] args) { String laf = UIManager.getSystemLookAndFeelClassName(); //laf = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel"; //laf = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"; //laf = "com.sun.java.swing.plaf.motif.MotifLookAndFeel"; //laf = "javax.swing.plaf.metal.MetalLookAndFeel"; try { UIManager.setLookAndFeel(laf); } catch (Exception e) { System.err.println(laf + " not supported."); } FileQueueTable q = new FileQueueTable(); JFrame f = new JFrame(); f.getContentPane().add(q); f.setVisible(true); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.pack(); }
From source file:ome.formats.importer.gui.GuiImporter.java
/** * Start up the application, display the main window and the login dialog. * /*w w w . ja v a2 s .co m*/ * @param args */ public static void main(String[] args) { try { LogAppenderProxy.configure(new File(IniFileLoader.LOGFILE)); } catch (Exception e) { GuiImporter.LoggingDisabledNotification(); } ImportConfig config = new ImportConfig(args.length > 0 ? new File(args[0]) : null); config.configureDebug(null); // Uses ini config.loadAll(); config.loadGui(); USE_QUAQUA = config.getUseQuaqua(); String laf = UIManager.getSystemLookAndFeelClassName(); //laf = "ch.randelshofer.quaqua.QuaquaLookAndFeel"; //laf = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel"; //laf = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"; //laf = "com.sun.java.swing.plaf.motif.MotifLookAndFeel"; //laf = "javax.swing.plaf.metal.MetalLookAndFeel"; if (laf.equals("apple.laf.AquaLookAndFeel") && USE_QUAQUA) { System.setProperty("Quaqua.design", "panther"); try { UIManager.setLookAndFeel("ch.randelshofer.quaqua.QuaquaLookAndFeel"); } catch (Exception e) { System.err.println(laf + " not supported."); } } else { try { UIManager.setLookAndFeel(laf); } catch (Exception e) { System.err.println(laf + " not supported."); } } /* Alternative GTK file chooser if ("GTK look and feel".equals(UIManager.getLookAndFeel().getName())) { UIManager.put("FileChooserUI", "eu.kostia.gtkjfilechooser.ui.GtkFileChooserUI"); } */ new GuiImporter(config); }
From source file:ome.formats.importer.gui.OptionsDialog.java
/** * Internal testing main (for debugging only) * @param args// ww w . j a v a2 s .c om * @throws Exception */ public static void main(String[] args) { String laf = UIManager.getSystemLookAndFeelClassName(); //laf = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"; //laf = "com.sun.java.swing.plaf.motif.MotifLookAndFeel"; //laf = "javax.swing.plaf.metal.MetalLookAndFeel"; //laf = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel"; try { UIManager.setLookAndFeel(laf); } catch (Exception e) { System.err.println(laf + " not supported."); } ImportConfig config = new ImportConfig(null); OptionsDialog dialog = new OptionsDialog(config, null, "Optional Settings", true); if (dialog != null) System.exit(0); }