List of usage examples for javax.swing UIManager getSystemLookAndFeelClassName
public static String getSystemLookAndFeelClassName()
LookAndFeel
class that implements the native system look and feel if there is one, otherwise the name of the default cross platform LookAndFeel
class. From source file:org.pmedv.core.gui.ApplicationWindowAdvisorImpl.java
@Override public void preWindowCreate() { log.info("initializing."); String laf = (String) Preferences.values.get("org.pmedv.blackboard.BoardDesignerPerspective.lookAndFeel"); try {/*from w ww .j a v a2s. c o m*/ if (laf.equals("Nimbus")) { UIManager.setLookAndFeel(new NimbusLookAndFeel()); } else if (laf.equals("SkyBlue")) { Plastic3DLookAndFeel.setPlasticTheme(new SkyBluer()); UIManager.setLookAndFeel(new Plastic3DLookAndFeel()); com.jgoodies.looks.Options.setPopupDropShadowEnabled(true); } else { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } } catch (Exception e2) { log.info("failed to set look and feel."); } final Color blackboardLightBlue = new Color(225, 234, 242); final Color blackBoardDarkBlue = new Color(182, 191, 205); final Color blackboardLightGrey = new Color(220, 220, 222); UIManager.put("TaskPane.titleBackgroundGradientStart", Color.WHITE); UIManager.put("TaskPane.titleBackgroundGradientEnd", blackboardLightBlue); UIManager.put("TaksPane.specialTitleBackground", blackboardLightBlue); UIManager.put("TaskPane.titleBackground", blackboardLightBlue); UIManager.put("TaskPane.borderColor", blackboardLightBlue); UIManager.put("TaskPane.background", blackboardLightGrey); UIManager.put("TaskPaneContainer.backgroundPainter", new MattePainter(blackBoardDarkBlue)); log.info("setting look and feel to: " + UIManager.getLookAndFeel()); // construct app icon Image iconImage = resources.getIcon("icon.application").getImage(); MediaTracker mt = new MediaTracker(win); mt.addImage(iconImage, 0); try { mt.waitForAll(); } catch (InterruptedException e) { // Silently ignore } InputStream is = getClass().getClassLoader().getResourceAsStream("application.properties"); Properties properties = new Properties(); try { properties.load(is); } catch (IOException e1) { properties.setProperty("version", "not set"); } win.setTitle(windowConfig.getConfig().getTitle() + " Version " + properties.get("version")); win.setIconImage(iconImage); win.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); win.addWindowListener(win); ToolTipManager.sharedInstance().setInitialDelay(100); ToolTipManager.sharedInstance().setDismissDelay(1000); }
From source file:org.rapidcontext.app.ui.ControlPanel.java
/** * Initializes the panel UI./*from ww w .j a v a 2 s .co m*/ */ private void initialize() { Rectangle bounds = new Rectangle(); GridBagConstraints c; JLabel label; Font font; Properties info; String str; // Set system UI looks if (SystemUtils.IS_OS_MAC_OSX || SystemUtils.IS_OS_WINDOWS) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception ignore) { // Ah well... at least we tried. } } // Set title, menu & layout setDefaultCloseOperation(EXIT_ON_CLOSE); setTitle("RapidContext Server"); setMenuBar(menuBar); initializeMenu(); getContentPane().setLayout(new GridBagLayout()); try { logotype = ImageIO.read(getClass().getResource("logotype.png")); Image img = ImageIO.read(getClass().getResource("logotype-icon-256x256.png")); setIconImage(img); if (SystemUtils.IS_OS_MAC_OSX) { MacApplication.get().setDockIconImage(img); } } catch (Exception ignore) { // Again, we only do our best effort here } // Add logotype c = new GridBagConstraints(); c.gridheight = 5; c.insets = new Insets(6, 15, 10, 10); c.anchor = GridBagConstraints.NORTHWEST; Image small = logotype.getScaledInstance(128, 128, Image.SCALE_SMOOTH); getContentPane().add(new JLabel(new ImageIcon(small)), c); // Add link label c = new GridBagConstraints(); c.gridx = 1; c.insets = new Insets(10, 10, 2, 10); c.anchor = GridBagConstraints.WEST; getContentPane().add(new JLabel("Server URL:"), c); serverLink.setText("http://localhost:" + server.port + "/"); serverLink.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { try { AppUtils.openURL(serverLink.getText()); } catch (Exception e) { error(e.getMessage()); } } }); c = new GridBagConstraints(); c.gridx = 2; c.weightx = 1.0; c.insets = new Insets(10, 0, 2, 10); c.anchor = GridBagConstraints.WEST; getContentPane().add(serverLink, c); // Add login info label label = new JLabel("Login as 'admin' on a new server."); font = label.getFont(); font = font.deriveFont(Font.ITALIC, font.getSize() - 2); label.setFont(font); c = new GridBagConstraints(); c.gridx = 2; c.gridy = 1; c.gridwidth = 2; c.insets = new Insets(0, 0, 6, 10); c.anchor = GridBagConstraints.WEST; getContentPane().add(label, c); // Add status label c = new GridBagConstraints(); c.gridx = 1; c.gridy = 2; c.insets = new Insets(0, 10, 6, 10); c.anchor = GridBagConstraints.WEST; getContentPane().add(new JLabel("Status:"), c); c = new GridBagConstraints(); c.gridx = 2; c.gridy = 2; c.insets = new Insets(0, 0, 6, 10); c.anchor = GridBagConstraints.WEST; getContentPane().add(statusLabel, c); // Add version label c = new GridBagConstraints(); c.gridx = 1; c.gridy = 3; c.insets = new Insets(0, 10, 6, 10); c.anchor = GridBagConstraints.WEST; getContentPane().add(new JLabel("Version:"), c); c = new GridBagConstraints(); c.gridx = 2; c.gridy = 3; c.insets = new Insets(0, 0, 6, 10); c.anchor = GridBagConstraints.WEST; info = Main.buildInfo(); str = info.getProperty("build.version") + " (built " + info.getProperty("build.date") + ")"; getContentPane().add(new JLabel(str), c); // Add buttons startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { start(); } }); c = new GridBagConstraints(); c.gridx = 1; c.gridy = 4; c.weighty = 1.0; c.insets = new Insets(0, 10, 10, 10); c.anchor = GridBagConstraints.SOUTH; getContentPane().add(startButton, c); stopButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { stop(); } }); c = new GridBagConstraints(); c.gridx = 2; c.gridy = 4; c.weighty = 1.0; c.insets = new Insets(0, 0, 10, 0); c.anchor = GridBagConstraints.SOUTHWEST; getContentPane().add(stopButton, c); // Set size & position pack(); bounds = this.getBounds(); bounds.width = 470; bounds.x = 100; bounds.y = 100; setBounds(bounds); }
From source file:org.renjin.desktop.MainFrame.java
private static void loadNativeLookAndFeel() { try {//from w w w . j ava 2 s . c om UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { e.printStackTrace(); } }
From source file:org.richie.codeGen.ui.CodeGenMainUI.java
public static void main(String[] args) { try {//from w ww. jav a 2 s.c om UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); CodeGenMainUI ui = new CodeGenMainUI(); ui.setVisible(true); ui.getTableSelectPanel().setDividerLocation(); } catch (Exception e) { log.error("??", e); e.printStackTrace(); } // ui.pack(); }
From source file:org.rimudb.editor.RimuDBEditor.java
/** * DataObjectEditor/* w w w . j ava 2 s . c o m*/ */ public RimuDBEditor() { super(TITLE); log.debug(System.getProperties()); logMemory(); // Create a preferences object preferences = new RimuDBPreferences(this.getClass().getName()); // Use the system l&f try { String plaf = UIManager.getSystemLookAndFeelClassName(); UIManager.setLookAndFeel(plaf); } catch (Exception e) { } setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { if (getDescriptorEditor().hasChanged()) { log.debug("windowClosing() Save changes to table descriptor?"); int option = JOptionPane.showConfirmDialog(RimuDBEditor.this, "Save changes to Table Descriptor?", "RimuDB Editor", JOptionPane.YES_NO_CANCEL_OPTION); // Cancel the close operation if (option == JOptionPane.CANCEL_OPTION) { // setVisible(true); return; } // Save the file if (option == JOptionPane.YES_OPTION) { log.debug("windowClosing() saving data"); getDescriptorFileContoller().save(); } } log.debug("System.exit(0)"); System.exit(0); } }); setIconImage(loadIcon("/images/rimudb_logo.gif").getImage()); descriptorFileController = new DescriptorFileController(this); setJMenuBar(buildJMenuBar()); JToolBar toolbar = createToolbar(); editor = new DescriptorEditor(this); JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.add(toolbar, BorderLayout.NORTH); panel.add(new JSeparator()); panel.add(editor, BorderLayout.CENTER); setContentPane(panel); pack(); editor.requestPackageFocus(); // Center in the screen setLocationRelativeTo(null); startDriverCheck(); }
From source file:org.rvsnoop.ui.RvSnoopApplication.java
private void configureLookAndFeel() { try {//from ww w .j a va 2 s . co m if (AppHelper.getPlatform() == PlatformType.OS_X) { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } else { for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } } catch (Exception e) { // If Nimbus is not available, you can set the GUI to another look and feel. } }
From source file:org.sikuli.ide.SikuliIDE.java
public static void main(String[] args) { Runtime.getRuntime().addShutdownHook(new Thread() { @Override/*from w ww .j ava 2s .co m*/ public void run() { log(lvl, "final cleanup"); if (isRunning != null) { try { isRunningFile.close(); } catch (IOException ex) { } isRunning.delete(); } FileManager.cleanTemp(); } }); // if (System.getProperty("sikuli.FromCommandLine") == null) { // String[] userOptions = collectOptions("IDE", args); // if (userOptions == null) { // System.exit(0); // } // if (userOptions.length > 0) { // for (String e : userOptions) { // log(lvl, "arg: " + e); // } // args = userOptions; // } // } start = (new Date()).getTime(); CommandArgs cmdArgs = new CommandArgs("IDE"); cmdLine = cmdArgs.getCommandLine(CommandArgs.scanArgs(args)); if (cmdLine == null) { Debug.error("Did not find any valid option on command line!"); System.exit(1); } if (cmdLine.hasOption(CommandArgsEnum.DEBUG.shortname())) { cmdValue = cmdLine.getOptionValue(CommandArgsEnum.DEBUG.longname()); if (cmdValue == null) { Debug.setDebugLevel(3); Debug.setLogFile(""); Settings.LogTime = true; } else { Debug.setDebugLevel(cmdValue); } } if (cmdLine.hasOption("h")) { cmdArgs.printHelp(); System.exit(0); } if (cmdLine.hasOption("c")) { System.setProperty("sikuli.console", "false"); } if (cmdLine.hasOption(CommandArgsEnum.LOGFILE.shortname())) { cmdValue = cmdLine.getOptionValue(CommandArgsEnum.LOGFILE.longname()); if (!Debug.setLogFile(cmdValue == null ? "" : cmdValue)) { System.exit(1); } } if (cmdLine.hasOption(CommandArgsEnum.USERLOGFILE.shortname())) { cmdValue = cmdLine.getOptionValue(CommandArgsEnum.USERLOGFILE.longname()); if (!Debug.setUserLogFile(cmdValue == null ? "" : cmdValue)) { System.exit(1); } } if (cmdLine.hasOption(CommandArgsEnum.LOAD.shortname())) { loadScripts = cmdLine.getOptionValues(CommandArgsEnum.LOAD.longname()); log(lvl, "requested to load: %s", loadScripts); } if (cmdLine.hasOption(CommandArgsEnum.RUN.shortname()) || cmdLine.hasOption(CommandArgsEnum.TEST.shortname()) || cmdLine.hasOption(CommandArgsEnum.INTERACTIVE.shortname())) { log(lvl, "Switching to ScriptRunner with option -r, -t or -i"); ScriptRunner.runscript(args); } new File(Settings.BaseTempPath).mkdirs(); isRunning = new File(Settings.BaseTempPath, "sikuli-ide-isrunning"); try { isRunning.createNewFile(); isRunningFile = new FileOutputStream(isRunning); if (null == isRunningFile.getChannel().tryLock()) { Sikulix.popError("Terminating on FatalError: IDE already running"); System.exit(1); } } catch (Exception ex) { Sikulix.popError("Terminating on FatalError: cannot access IDE lock for/n" + isRunning); System.exit(1); } Settings.isRunningIDE = true; if (Settings.isMac()) { System.setProperty("apple.laf.useScreenMenuBar", "true"); System.setProperty("com.apple.mrj.application.apple.menu.about.name", "SikuliX-IDE"); } getInstance(); Settings.setArgs(cmdArgs.getUserArgs(), cmdArgs.getSikuliArgs()); Settings.showJavaInfo(); Settings.printArgs(); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); //TODO UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); } catch (Exception e) { log(-1, "Problem loading UIManager!\nError: %s", e.getMessage()); } ScriptRunner.initScriptingSupport(); IDESupport.initIDESupport(); sikulixIDE.initNativeSupport(); sikulixIDE.initSikuliIDE(args); }
From source file:org.siyapath.SiyapathNode.java
/** * @param args/* ww w. ja va 2 s . co m*/ */ public static void main(String[] args) { NodeInfo nodeInfo = new NodeInfo(); boolean showUI = true; if (args.length == 1) { if (args[0].equals("bs")) { nodeInfo.setBootstrapper(true); nodeInfo.setPort(CommonUtils.getBootstrapperPort()); showUI = false; } else if (args[0].equals("cl")) { showUI = false; } } SiyapathNode node = new SiyapathNode(nodeInfo); if (showUI) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (UnsupportedLookAndFeelException e) { } catch (ClassNotFoundException e) { } catch (InstantiationException e) { } catch (IllegalAccessException e) { } node.getNodeContext().setGuiEnabled(true); NodeGUI gui = new NodeGUI(); gui.setVisible(true); NodeUIHandler uiHandler = new NodeUIHandler(node.getNodeContext(), gui); uiHandler.startMonitor(); } node.startSiyapathNode(); }
From source file:org.sleeksnap.ScreenSnapper.java
/** * Initialize the program/*w w w . j a va2s. co m*/ * * @param map * Flag to reset configuration */ private void initialize(final Map<String, Object> map) { // Check for a configuration option if (map.containsKey("dir")) { final File file = new File(map.get("dir").toString()); if (!file.exists()) { file.mkdirs(); } Util.setWorkingDirectory(file); } // Verify the directory final File local = Util.getWorkingDirectory(); if (!local.exists()) { local.mkdirs(); } // Load the Release info final URL releaseUrl = Util.getResourceByName("/org/sleeksnap/release.json"); JSONObject releaseInfo = new JSONObject(); if (releaseUrl != null) { try { releaseInfo = new JSONObject(new JSONTokener(releaseUrl.openStream())); } catch (final IOException e) { e.printStackTrace(); } } // Set the UI skin try { UIManager.setLookAndFeel(releaseInfo.getString("uiClass", UIManager.getSystemLookAndFeelClassName())); } catch (final Exception e) { e.printStackTrace(); } // Then start try { LoggingManager.configure(); } catch (final IOException e) { logger.log(Level.WARNING, "Unable to configure logger, file logging and logging panel will not work.", e); JOptionPane.showMessageDialog(null, "Unable to configure logger, file logging and logging panel will not work.", "Error", JOptionPane.ERROR_MESSAGE); } logger.info("Loading plugins..."); try { loadUploaders(); loadFilters(); } catch (final Exception e) { logger.log(Level.SEVERE, "Failed to load plugins!", e); } // Load the settings logger.info("Loading settings..."); try { loadSettings(map.containsKey("resetconfig")); } catch (final Exception e) { logger.log(Level.SEVERE, "Failed to load settings!", e); } // Load the selected language try { Language.load(map.containsKey("language") ? map.get("language").toString() : configuration.getString("language", Constants.Configuration.DEFAULT_LANGUAGE)); } catch (final IOException e) { logger.log(Level.SEVERE, "Failed to load language file!", e); } // Check the update mode final UpdaterMode mode = configuration.getEnumValue("updateMode", UpdaterMode.class); if (mode != UpdaterMode.MANUAL) { final UpdaterReleaseType type = configuration.getEnumValue("updateReleaseType", UpdaterReleaseType.class); final Updater updater = new Updater(); if (updater.checkUpdate(type, mode == UpdaterMode.PROMPT)) { return; } } // Load the history logger.info("Loading history..."); final File historyFile = new File(local, "history.json"); history = new History(historyFile); if (historyFile.exists()) { logger.info("Using existing history file."); try { history.load(); } catch (final Exception e) { logger.log(Level.WARNING, "Failed to load history", e); } } else { logger.info("Using new history file."); } // Validate settings if (!configuration.contains("hotkeys") || !configuration.contains("uploaders")) { promptConfigurationReset(); } // Register the hotkeys logger.info("Registering keys..."); keyManager = new HotkeyManager(this); keyManager.initializeInput(); logger.info("Opening tray icon..."); initializeTray(); logger.info("Ready."); }
From source file:org.smart.migrate.ui.MigrateMain.java
/** * @param args the command line arguments *//* w ww. j a va2 s .co m*/ public static void main(String args[]) { try { /* 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 */ // for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { // if ("Nimbus".equals(info.getName())) { // javax.swing.UIManager.setLookAndFeel(info.getClassName()); // break; // } // } UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException ex) { Logger.getLogger(MigrateMain.class.getName()).log(Level.SEVERE, null, ex); } catch (InstantiationException ex) { Logger.getLogger(MigrateMain.class.getName()).log(Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { Logger.getLogger(MigrateMain.class.getName()).log(Level.SEVERE, null, ex); } catch (UnsupportedLookAndFeelException ex) { Logger.getLogger(MigrateMain.class.getName()).log(Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { MigrateMain migrateMain = new MigrateMain(); migrateMain.setLocationRelativeTo(null); migrateMain.setVisible(true); } }); }