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:org.sbml.bargraph.MainWindow.java
/** * Configure the windows for platform the user is running. *///from w w w.j a va 2 s . c o m public void setPlatformProperties() { if (Config.runningMac()) { // Extra settings for making the app look natural on Mac OS X. Log.note("This is a Mac; setting properties appropriately."); System.setProperty("apple.laf.useScreenMenuBar", "true"); System.setProperty("com.apple.mrj.application.apple.menu.about.name", Config.APP_NAME); System.setProperty("apple.awt.showGrowBox", "true"); } try { // Set System L&F UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (UnsupportedLookAndFeelException e) { Log.warning("Unable to set look and feel. Proceeding anyway."); } catch (Exception e) { Log.warning("Unexpected look & feel configuration failure -- " + "something more serious may be wrong"); } }
From source file:com.pianobakery.complsa.MainGui.java
public static void main(String[] args) { // take the menu bar off the jframe System.setProperty("apple.laf.useScreenMenuBar", "true"); // set the name of the application menu item //System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Semantic Analysis"); // set the look and feel try {/*ww w. j a v a2 s.com*/ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (UnsupportedLookAndFeelException e) { e.printStackTrace(); } //StartUI frame = new JFrame("MainGui"); maingui = new MainGui(); frame.setContentPane(maingui.mainPanel); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setLocationRelativeTo(null); frame.setTitle("Semantic Search"); int frameWidth = 1280; int frameHeight = 800; frame.setMinimumSize(new Dimension(frameWidth, frameHeight)); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); frame.setBounds((int) screenSize.getWidth() / 2 - frameWidth / 2, (int) screenSize.getHeight() / 4 - frameHeight / 4, frameWidth, frameHeight); JMenuBar menu = MenuExp(); frame.setJMenuBar(menu); //Sets Button as always selected //JRootPane rootPane = SwingUtilities.getRootPane(maingui.searchButton); //rootPane.setDefaultButton(maingui.searchButton); frame.setVisible(true); }
From source file:v800_trainer.JCicloTronic.java
/** Creates new form JCicloTronic */ public JCicloTronic() { ScreenSize = new Dimension(); SelectionChanged = false;/*ww w .j av a 2s.co m*/ ScreenSize.setSize(java.awt.Toolkit.getDefaultToolkit().getScreenSize().getWidth() - 50, java.awt.Toolkit.getDefaultToolkit().getScreenSize().getHeight() - 50); Size = new Dimension(); Properties = new java.util.Properties(); SystemProperties = java.lang.System.getProperties(); chooser = new javax.swing.JFileChooser(); RawData = new byte[98316]; // System.setProperty("jna.library.path" , "C:/WINDOWS/system32"); try { FileInputStream in = new FileInputStream(SystemProperties.getProperty("user.dir") + SystemProperties.getProperty("file.separator") + "JCicloexp.cfg"); Properties.load(in); in.close(); } catch (Exception e) { FontSize = 20; setFontSizeGlobal("Tahoma", FontSize); JOptionPane.showMessageDialog(null, "Keine Config-Datei in: " + SystemProperties.getProperty("user.dir"), "Achtung!", JOptionPane.ERROR_MESSAGE); Properties.put("working.dir", SystemProperties.getProperty("user.dir")); Eigenschaften = new Eigenschaften(new javax.swing.JFrame(), true, this); this.setExtendedState(Frame.MAXIMIZED_BOTH); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); double width = screenSize.getWidth(); double height = screenSize.getHeight(); this.setSize(new Dimension((int) width, (int) height)); this.setPreferredSize(new Dimension((int) width, (int) height)); this.setMinimumSize(new Dimension((int) width, (int) height)); repaint(); } try { UIManager.setLookAndFeel(Properties.getProperty("LookFeel")); SwingUtilities.updateComponentTreeUI(this); this.pack(); } catch (Exception exc) { } if (debug) { try { System.setErr(new java.io.PrintStream(new FileOutputStream(Properties.getProperty("working.dir") + SystemProperties.getProperty("file.separator") + "error.txt"))); // System.err = new FileOutputStream(Properties.getProperty("working.dir") + SystemProperties.getProperty("file.separator") + "error.txt"); System.setOut(new java.io.PrintStream(new FileOutputStream(Properties.getProperty("working.dir") + SystemProperties.getProperty("file.separator") + "error.txt"))); } catch (Exception err) { } } initComponents(); setTitle("V800 Trainer Datadir: " + Properties.getProperty("data.dir")); icon = new ImageIcon("hw.jpg"); setIconImage(icon.getImage()); if (Integer.parseInt(Properties.getProperty("View Geschw", "1")) == 1) { Graphik_check_Geschwindigkeit.setSelected(true); } else { Graphik_check_Geschwindigkeit.setSelected(false); } if (Integer.parseInt(Properties.getProperty("View Hhe", "1")) == 1) { Graphik_check_Hhe.setSelected(true); } else { Graphik_check_Hhe.setSelected(false); } if (Integer.parseInt(Properties.getProperty("View Hf", "1")) == 1) { Graphik_check_HF.setSelected(true); } else { Graphik_check_HF.setSelected(false); } if (Integer.parseInt(Properties.getProperty("View Temp", "1")) == 1) { Graphik_check_Temp.setSelected(true); } else { Graphik_check_Temp.setSelected(false); } if (Integer.parseInt(Properties.getProperty("View Steigp", "1")) == 1) { Graphik_check_Steigung_p.setSelected(true); } else { Graphik_check_Steigung_p.setSelected(false); } if (Integer.parseInt(Properties.getProperty("View Steigm", "1")) == 1) { Graphik_check_Steigung_m.setSelected(true); } else { Graphik_check_Steigung_m.setSelected(false); } if (Integer.parseInt(Properties.getProperty("View av_Geschw", "1")) == 1) { Graphik_check_av_Geschw.setSelected(true); } else { Graphik_check_av_Geschw.setSelected(false); } if (Integer.parseInt(Properties.getProperty("View Cadence", "1")) == 1) { Graphik_check_Cadence.setSelected(true); } else { Graphik_check_Cadence.setSelected(false); } if (Integer.parseInt(Properties.getProperty("View Schrittlnge", "1")) == 1) { Graphik_check_Schrittlnge.setSelected(true); } else { Graphik_check_Schrittlnge.setSelected(false); } if (Integer.parseInt(Properties.getProperty("ZeitStreckeAbstnde", "1")) == 1) { Graphik_check_Abstand.setSelected(true); } else { Graphik_check_Abstand.setSelected(false); } if (Integer.parseInt(Properties.getProperty("SummenHisto", "1")) == 1) { Summenhistogramm_Check.setSelected(true); } else { Summenhistogramm_Check.setSelected(false); } if (Integer.parseInt(Properties.getProperty("xy_Strecke", "1")) == 1) { Graphik_Radio_Strecke.setSelected(true); Graphik_Radio_Zeit.setSelected(false); } else { Graphik_Radio_Strecke.setSelected(false); Graphik_Radio_Zeit.setSelected(true); } //Buttons fr XY-Darstellung (ber Strecke oder ber Zeit) X_Axis = new ButtonGroup(); X_Axis.add(Graphik_Radio_Strecke); X_Axis.add(Graphik_Radio_Zeit); //Buttons fr Jahresbersicht bersicht = new ButtonGroup(); bersicht.add(jRadioButton_jahresverlauf); bersicht.add(jRadioButton_monatsbersicht); Datenliste_Zeitabschnitt.addItem("nicht aktiv"); Datenliste_Zeitabschnitt.addItem("vergangene Woche"); Datenliste_Zeitabschnitt.addItem("vergangener Monat"); Datenliste_Zeitabschnitt.addItem("vergangenes Jahr"); Datenliste_Zeitabschnitt.addItem("Alles"); if (Datentabelle.getRowCount() != 0) { Datentabelle.addRowSelectionInterval(0, 0); Datenliste_scroll_Panel.getViewport().setViewPosition(new java.awt.Point(0, 0)); } // if (Properties.getProperty("CommPort").equals("nocom")) { // jMenuReceive.setEnabled(false); // } else { // jMenuReceive.setEnabled(true); // } jLabel69_Selektiert.setText(Datentabelle.getSelectedRowCount() + " / " + Datentabelle.getRowCount()); setFileChooserFont(chooser.getComponents()); locmap = true; Map_Type.removeAllItems(); Map_Type.addItem("OpenStreetMap"); Map_Type.addItem("Virtual Earth Map"); Map_Type.addItem("Virtual Earth Satelite"); Map_Type.addItem("Virtual Earth Hybrid"); locmap = false; // ChangeModel(); }
From source file:archive_v1.Retrieve.java
/** * @param args the command line arguments *//* w ww. j av a2s . co m*/ 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()) { UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(Retrieve.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Retrieve.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Retrieve.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Retrieve.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 Retrieve().setVisible(true); } }); }
From source file:net.sf.jabref.JabRefGUI.java
private void setLookAndFeel() { try {/* w ww . j av a 2s . c om*/ String lookFeel; String systemLookFeel = UIManager.getSystemLookAndFeelClassName(); if (Globals.prefs.getBoolean(JabRefPreferences.USE_DEFAULT_LOOK_AND_FEEL)) { // FIXME: Problems with OpenJDK and GTK L&F // See https://github.com/JabRef/jabref/issues/393, https://github.com/JabRef/jabref/issues/638 if (System.getProperty("java.runtime.name").contains("OpenJDK")) { // Metal L&F lookFeel = UIManager.getCrossPlatformLookAndFeelClassName(); LOGGER.warn( "There seem to be problems with OpenJDK and the default GTK Look&Feel. Using Metal L&F instead. Change to another L&F with caution."); } else { lookFeel = systemLookFeel; } } else { lookFeel = Globals.prefs.get(JabRefPreferences.WIN_LOOK_AND_FEEL); } // FIXME: Open JDK problem if (UIManager.getCrossPlatformLookAndFeelClassName().equals(lookFeel) && !System.getProperty("java.runtime.name").contains("OpenJDK")) { // try to avoid ending up with the ugly Metal L&F Plastic3DLookAndFeel lnf = new Plastic3DLookAndFeel(); Plastic3DLookAndFeel.setCurrentTheme(new SkyBluer()); com.jgoodies.looks.Options.setPopupDropShadowEnabled(true); UIManager.setLookAndFeel(lnf); } else { try { UIManager.setLookAndFeel(lookFeel); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) { // specified look and feel does not exist on the classpath, so use system l&f UIManager.setLookAndFeel(systemLookFeel); // also set system l&f as default Globals.prefs.put(JabRefPreferences.WIN_LOOK_AND_FEEL, systemLookFeel); // notify the user JOptionPane.showMessageDialog(JabRefGUI.getMainFrame(), Localization.lang( "Unable to find the requested look and feel and thus the default one is used."), Localization.lang("Warning"), JOptionPane.WARNING_MESSAGE); LOGGER.warn("Unable to find requested look and feel", e); } } } catch (Exception e) { LOGGER.warn("Look and feel could not be set", e); } // In JabRef v2.8, we did it only on NON-Mac. Now, we try on all platforms boolean overrideDefaultFonts = Globals.prefs.getBoolean(JabRefPreferences.OVERRIDE_DEFAULT_FONTS); if (overrideDefaultFonts) { int fontSize = Globals.prefs.getInt(JabRefPreferences.MENU_FONT_SIZE); UIDefaults defaults = UIManager.getDefaults(); Enumeration<Object> keys = defaults.keys(); for (Object key : Collections.list(keys)) { if ((key instanceof String) && ((String) key).endsWith(".font")) { FontUIResource font = (FontUIResource) UIManager.get(key); font = new FontUIResource(font.getName(), font.getStyle(), fontSize); defaults.put(key, font); } } } }
From source file:be.ac.ua.comp.scarletnebula.gui.windows.GUI.java
private void chooseLookAndFeel() { try {/*from w w w . ja v a 2 s . com*/ boolean found = false; for (final LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); found = true; break; } } if (!found) { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } } catch (final Exception e) { log.error("Cannot set look and feel", e); } }
From source file:com.adito.server.Main.java
public Integer start(String[] args) { startupStarted = System.currentTimeMillis(); // Inform the wrapper the startup process may take a while if (useWrapper) { WrapperManager.signalStarting(60000); }/* www. j av a 2 s .c om*/ // Parse the command line Integer returnCode = parseCommandLine(args); if (returnCode != null) { if (returnCode.intValue() == 999) { return null; } return returnCode; } // Create the boot progress monitor if (gui) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { } bootProgressMonitor = new SwingBootProgressMonitor(); } else { bootProgressMonitor = new LogBootProgressMonitor(); } // resourceCaches = new HashMap<URL, ResourceCache>(); contextListeners = new ArrayList<ContextListener>(); loadSystemProperties(); initialiseLogging(); /* * Migrate preferences. */ File newPrefDir = new File(ContextHolder.getContext().getConfDirectory(), "prefs"); PREF = PropertyPreferences.SYSTEM_ROOT; try { if (!newPrefDir.exists() && Preferences.systemRoot().node("/com").nodeExists("adito")) { Preferences from = Preferences.systemRoot().node("/com/adito"); log.warn("Migrating preferences"); try { copyNode(from.node("core"), PREF.node("core")); from.node("core").removeNode(); copyNode(from.node("plugin"), PREF.node("plugin")); from.node("plugin").removeNode(); copyNode(from.node("extensions"), PREF.node("extensions")); from.node("extensions").removeNode(); copyNode(from.node("dbupgrader"), PREF.node("dbupgrader")); from.node("dbupgrader").removeNode(); } catch (Exception e) { log.error("Failed to migrate preferences.", e); } try { from.flush(); } catch (BackingStoreException bse) { log.error("Failed to flush old preferences"); } try { PREF.flush(); } catch (BackingStoreException bse) { log.error("Failed to flush new preferences"); } if (log.isInfoEnabled()) { log.info("Flushing preferences"); } } } catch (BackingStoreException bse) { log.error("Failed to migrate preferences.", bse); } // Inform the wrapper the startup process is going ok if (useWrapper) { WrapperManager.signalStarting(60000); } try { clearTemp(); try { hostname = Inet4Address.getLocalHost().getCanonicalHostName(); hostAddress = Inet4Address.getLocalHost().getHostAddress(); } catch (Exception ex) { // This should be fatal, we now rely on the hostname being // available throw new Exception("The host name or address on which this service is running could not " + "be determined. Check you network configuration. One possible cause is " + "a misconfigured 'hosts' file (e.g. on UNIX-like systems this would be " + "/etc/hosts, on Windows XP it would be " + "C:\\Windows\\System32\\Drivers\\Etc\\Hosts)."); } PropertyClassManager.getInstance() .registerPropertyClass(contextConfiguration = new ContextConfig(getClass().getClassLoader())); // Display some information about the system we are running on displaySystemInfo(); // Load the context property definitions loadContextProperties(); // Inform the wrapper the startup process is going ok if (useWrapper) { WrapperManager.signalStarting(60000); } // Configure any HTTP / HTTPS / SOCKS proxy servers configureProxyServers(); PropertyList l = contextConfiguration.retrievePropertyList(new ContextKey("webServer.bindAddress")); getBootProgressMonitor().updateMessage("Creating server lock"); getBootProgressMonitor().updateProgress(6); serverLock = new ServerLock((String) l.get(0)); if (serverLock.isLocked()) { if (!isSetupMode()) { if (serverLock.isSetup()) { throw new Exception("The installation wizard is currently running. " + "Please shut this down by pointing your browser " + "to http://" + getHostname() + ":" + serverLock.getPort() + "/showShutdown.do before attempting to start the server again."); } else { throw new Exception("The server is already running."); } } else { if (!serverLock.isSetup()) { throw new Exception("The server is currently already running. " + "Please shut this down by pointing your browser " + "to https://" + getHostname() + ":" + serverLock.getPort() + "/showShutdown.do before attempting to start the server again."); } else { throw new Exception("The installation wizard is running.."); } } } // Inform the wrapper the startup process is going ok if (useWrapper) { WrapperManager.signalStarting(60000); } Runtime.getRuntime().addShutdownHook(new Thread() { public void run() { serverLock.stop(); } }); // registerKeyStores(); // threadGroup = new ThreadGroup("MainThreadGroup"); if (install) { setupMode(); } else { normalMode(); startHttpServer(); } } catch (Throwable t) { startupException = t; log.error("Failed to start the server. " + t.getMessage(), t); return new Integer(1); } return null; }
From source file:net.sf.nmedit.nomad.core.NomadLoader.java
private void initLookAndFeel(String lafClassName, String themeClassName, String defaultLafOnPlatform) { EnumSet<Platform.OS> defaultLafPlatforms = EnumSet.noneOf(Platform.OS.class); {/*from w ww .j av a 2 s . c om*/ // remove whitespace + lowercase defaultLafOnPlatform = defaultLafOnPlatform.replaceAll("\\s", "").toLowerCase(); // split comma separated list String[] dlop = defaultLafOnPlatform.split(","); // check items for (String s : dlop) { if (s.equals("all")) { // on all platforms defaultLafPlatforms.addAll(EnumSet.allOf(Platform.OS.class)); break; } else if (s.equals("mac")) { defaultLafPlatforms.add(Platform.OS.MacOSFlavor); } else if (s.equals("unix")) { defaultLafPlatforms.add(Platform.OS.UnixFlavor); } else if (s.equals("windows")) { defaultLafPlatforms.add(Platform.OS.WindowsFlavor); } } } // jgoodies specific properties PlasticLookAndFeel.setTabStyle(PlasticLookAndFeel.TAB_STYLE_METAL_VALUE); //UIManager.put(Options.POPUP_DROP_SHADOW_ENABLED_KEY, Boolean.FALSE); Options.setPopupDropShadowEnabled(false); Options.setUseNarrowButtons(true); //UIManager.put(Options.PLASTIC_MENU_FONT_KEY, new FontUIResource("Verdana", Font.PLAIN, 9)); //PlasticLookAndFeel.setFontPolicy(FontPolicies.getDefaultWindowsPolicy()); /* UIManager.put("MenuItem.margin", new InsetsUIResource(2,2,1,2)); UIManager.put("Menu.margin", new InsetsUIResource(1,2,1,2)); */ // set the metal theme if (defaultLafPlatforms.contains(Platform.flavor())) { // use default LAF on current platform try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Throwable e) { Log log = LogFactory.getLog(getClass()); log.warn("could not set look and feel theme", e); } if (Platform.isFlavor(Platform.OS.MacOSFlavor)) { System.setProperty("apple.laf.useScreenMenuBar", "true"); } } else { // use LAF setting MetalTheme theme = null; if (themeClassName != null) { try { theme = (MetalTheme) Class.forName(themeClassName).newInstance(); UIManager.put("Plastic.theme", themeClassName); if (theme instanceof PlasticTheme) { PlasticLookAndFeel.setPlasticTheme((PlasticTheme) theme); // PlasticLookAndFeel.setTabStyle(settings.getPlasticTabStyle()); } else if (theme instanceof MetalTheme) { MetalLookAndFeel.setCurrentTheme(theme); } } catch (Throwable e) { Log log = LogFactory.getLog(getClass()); log.warn("could not set look and feel theme", e); } } // set the look and feel if (lafClassName != null) { try { LookAndFeel LAF = (LookAndFeel) Class.forName(lafClassName).newInstance(); // it is very important to set the classloader UIManager.getDefaults().put("ClassLoader", getClass().getClassLoader()); UIManager.setLookAndFeel(LAF); } catch (Throwable e) { Log log = LogFactory.getLog(getClass()); log.warn("could not set custom look and feel", e); } } } }
From source file:com.sslexplorer.server.Main.java
public Integer start(String[] args) { startupStarted = System.currentTimeMillis(); // Inform the wrapper the startup process may take a while if (useWrapper) { WrapperManager.signalStarting(60000); }//from w w w. ja va2s.c o m // Parse the command line Integer returnCode = parseCommandLine(args); if (returnCode != null) { if (returnCode.intValue() == 999) { return null; } return returnCode; } // Create the boot progress monitor if (gui) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { } bootProgressMonitor = new SwingBootProgressMonitor(); } else { bootProgressMonitor = new LogBootProgressMonitor(); } // resourceCaches = new HashMap<URL, ResourceCache>(); contextListeners = new ArrayList<ContextListener>(); loadSystemProperties(); initialiseLogging(); /* * Migrate preferences. */ File newPrefDir = new File(ContextHolder.getContext().getConfDirectory(), "prefs"); PREF = PropertyPreferences.SYSTEM_ROOT; try { if (!newPrefDir.exists() && Preferences.systemRoot().node("/com").nodeExists("sslexplorer")) { Preferences from = Preferences.systemRoot().node("/com/sslexplorer"); log.warn("Migrating preferences"); try { copyNode(from.node("core"), PREF.node("core")); from.node("core").removeNode(); copyNode(from.node("plugin"), PREF.node("plugin")); from.node("plugin").removeNode(); copyNode(from.node("extensions"), PREF.node("extensions")); from.node("extensions").removeNode(); copyNode(from.node("dbupgrader"), PREF.node("dbupgrader")); from.node("dbupgrader").removeNode(); } catch (Exception e) { log.error("Failed to migrate preferences.", e); } try { from.flush(); } catch (BackingStoreException bse) { log.error("Failed to flush old preferences"); } try { PREF.flush(); } catch (BackingStoreException bse) { log.error("Failed to flush new preferences"); } if (log.isInfoEnabled()) { log.info("Flushing preferences"); } } } catch (BackingStoreException bse) { log.error("Failed to migrate preferences.", bse); } // Inform the wrapper the startup process is going ok if (useWrapper) { WrapperManager.signalStarting(60000); } try { clearTemp(); try { hostname = Inet4Address.getLocalHost().getCanonicalHostName(); hostAddress = Inet4Address.getLocalHost().getHostAddress(); } catch (Exception ex) { // This should be fatal, we now rely on the hostname being // available throw new Exception("The host name or address on which this service is running could not " + "be determined. Check you network configuration. One possible cause is " + "a misconfigured 'hosts' file (e.g. on UNIX-like systems this would be " + "/etc/hosts, on Windows XP it would be " + "C:\\Windows\\System32\\Drivers\\Etc\\Hosts)."); } PropertyClassManager.getInstance() .registerPropertyClass(contextConfiguration = new ContextConfig(getClass().getClassLoader())); // Display some information about the system we are running on displaySystemInfo(); // Load the context property definitions loadContextProperties(); // Inform the wrapper the startup process is going ok if (useWrapper) { WrapperManager.signalStarting(60000); } // Configure any HTTP / HTTPS / SOCKS proxy servers configureProxyServers(); PropertyList l = contextConfiguration.retrievePropertyList(new ContextKey("webServer.bindAddress")); getBootProgressMonitor().updateMessage("Creating server lock"); getBootProgressMonitor().updateProgress(6); serverLock = new ServerLock((String) l.get(0)); if (serverLock.isLocked()) { if (!isSetupMode()) { if (serverLock.isSetup()) { throw new Exception("The installation wizard is currently running. " + "Please shut this down by pointing your browser " + "to http://" + getHostname() + ":" + serverLock.getPort() + "/showShutdown.do before attempting to start the server again."); } else { throw new Exception("The server is already running."); } } else { if (!serverLock.isSetup()) { throw new Exception("The server is currently already running. " + "Please shut this down by pointing your browser " + "to https://" + getHostname() + ":" + serverLock.getPort() + "/showShutdown.do before attempting to start the server again."); } else { throw new Exception("The installation wizard is running.."); } } } // Inform the wrapper the startup process is going ok if (useWrapper) { WrapperManager.signalStarting(60000); } Runtime.getRuntime().addShutdownHook(new Thread() { public void run() { serverLock.stop(); } }); // registerKeyStores(); // threadGroup = new ThreadGroup("MainThreadGroup"); if (install) { setupMode(); } else { normalMode(); startHttpServer(); } } catch (Throwable t) { startupException = t; log.error("Failed to start the server. " + t.getMessage(), t); return new Integer(1); } return null; }
From source file:com.enderville.enderinstaller.ui.Installer.java
public static void main(String[] args) throws IOException { LOGGER.debug("Starting EnderPack Installer"); LOGGER.debug("Current OS: " + InstallerConfig.currentOS); if (!sanityCheck()) { return;/*from w w w.jav a 2 s .c o m*/ } try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { LOGGER.warn("Couldn't set the look and feel", e); } Installer installer = new Installer(); installer.setVisible(true); }