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:QueryConnector.java
public static void info(XComponentContext componentContext, XModel model) { QueryConnector connector = null;//ww w. j av a 2s . c o m try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); connector = new QueryConnector(model, componentContext); connector.info(); } catch (Exception ex) { if (connector != null) connector.enableEdit(); ExceptionDialog.show(null, ex); } }
From source file:QueryConnector.java
public static void silentUpdateAll(XComponentContext componentContext, XModel model) { QueryConnector connector = null;//from www . j av a 2 s. com try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); connector = new QueryConnector(model, componentContext); connector.setSilent(true); connector.updateAll(); } catch (Exception ex) { if (connector != null) connector.enableEdit(); ExceptionDialog.show(null, ex); } }
From source file:net.sf.profiler4j.console.Console.java
public static void main(String[] args) { System.out.println();/* w w w .j a v a 2 s. co m*/ System.out.println("+--------------------------------------------------------+"); System.out.println("| Profiler4j-Fork Console " + String.format("%-31s", AgentConstants.VERSION) + "|"); System.out.println("| Copyright 2006 Antonio S. R. Gomes |"); System.out.println("| Copyright 2009 Murat Knecht |"); System.out.println("| See LICENSE-2.0.txt for details |"); System.out.println("+--------------------------------------------------------+"); Prefs prefs = new Prefs(); System.setProperty("swing.aatext", String.valueOf(prefs.isAntialiasing())); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { // ignore } final Console app = new Console(prefs); SwingUtilities.invokeLater(new Runnable() { public void run() { MainFrame f = new MainFrame(app); app.setMainFrame(f); f.pack(); f.setVisible(true); } }); }
From source file:net.sf.jabref.JabRefGUI.java
private void setLookAndFeel() { try {// w w w .j av a2 s . 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:forms.frDados.java
/** * Carrega os temas disponveis e adiciona ao menu de temas. *///from w w w . ja va 2 s . c om private void inicializarTemas() { String winLnF = UIManager.getSystemLookAndFeelClassName(); ButtonGroup group = new ButtonGroup(); for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { JRadioButtonMenuItem mnuItem = new JRadioButtonMenuItem(info.getName()); mnuItem.addActionListener(this); if (winLnF.equals(info.getClassName())) mnuItem.setSelected(true); group.add(mnuItem); mnuTemas.add(mnuItem); } }
From source file:com.moteiv.trawler.Trawler.java
public Trawler(String[] args) { init(args);//w w w. j a va 2s . c om // Install a different look and feel; specifically, the Windows look and feel try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); //"com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); } catch (InstantiationException e) { } catch (ClassNotFoundException e) { } catch (UnsupportedLookAndFeelException e) { } catch (IllegalAccessException e) { } jf = new JFrame("Trawler"); jf.setJMenuBar(getMainMenuBar()); g = new SparseGraph(); layout = new FRLayout(g); indexer = Indexer.newIndexer(g, 0); // layout.initialize(new Dimension(100, 100)); mif = new MoteInterface(g, Trawler.GROUPID, layout); uartDetect = new UartDetect(mif.getMoteIF()); Thread th = new Thread(uartDetect); th.start(); pr = new myPluggableRenderer(); vv = new VisualizationViewer(layout, pr); vv.init(); vv.setPickSupport(new ShapePickSupport()); vv.setBackground(Color.white); vv.setToolTipListener(new NodeTips(vv)); myVertexShapeFunction vsf = new myVertexShapeFunction(uartDetect); pr.setVertexShapeFunction(vsf); pr.setVertexIconFunction(vsf);//new myVertexShapeFunction()); m_vs = new VertexLabel(); java.awt.Font f = new java.awt.Font("Arial", Font.PLAIN, 12); pr.setEdgeFontFunction(new ConstantEdgeFontFunction(f)); pr.setVertexStringer(m_vs); m_es = new myEdgeLabel(); pr.setEdgeStringer(m_es); ((AbstractEdgeShapeFunction) pr.getEdgeShapeFunction()).setControlOffsetIncrement(-50.f); // pr.setVertexColorFunction(new myVertexColorFunction(Color.RED.darker().darker(), Color.RED, 500l)); pr.setEdgeStrokeFunction(new EdgeWeightStrokeFunction()); pr.setEdgeLabelClosenessFunction(new ConstantDirectionalEdgeValue(0.5, 0.5)); pr.setEdgePaintFunction(new myEdgeColorFunction()); scrollPane = new GraphZoomScrollPane(vv); jf.getContentPane().setLayout(new BoxLayout(jf.getContentPane(), BoxLayout.LINE_AXIS)); JTabbedPane pane = new JTabbedPane(); pane.addTab("Network Topology", scrollPane); pane.addTab("Sensor readings", createOscopePanel(mif.getMoteIF(), "ADC Readings", -33, -456, 300, 4100, "Time (seconds)", "ADC counts")); pane.addTab("Link Quality", createOscopePanel(mif.getMoteIF(), "LinkQualityPanel", -33, -15, 300, 135, "Time (seconds)", "Link Quality Indicator")); ImageIcon trawlerIcon = new ImageIcon(Trawler.class.getResource("images/trawler-icon.gif")); Image imageTrawler = trawlerIcon.getImage(); jf.getContentPane().add(pane); controlBoxFrame = new JFrame("Vizualization Control"); controlBoxFrame.getContentPane().add(getControls()); controlBoxFrame.setIconImage(imageTrawler); controlBoxFrame.pack(); // jf.getContentPane().add(getControls()); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); layout.initialize(vv.getSize()); layout.resize(vv.getSize()); layout.update(); loadPrefs(); GraphIO.loadGraph(g, layout, mif, Trawler.NODEFILE); // need this mouse model to keep the mouse clicks // aligned with the nodes DefaultModalGraphMouse gm = new DefaultModalGraphMouse(); gm.setMode(ModalGraphMouse.Mode.PICKING); vv.setGraphMouse(gm); jf.setIconImage(imageTrawler); jf.pack(); jf.show(); controlBoxFrame.setVisible(true); timer = new Timer(); timer.schedule(new UpdateTask(), 500, 500); }
From source file:gov.nih.nci.nbia.StandaloneDMV3.java
private void constructDownloadManager(List<String> seriesInfo, String userId, String password) { try {/*from w ww . ja va 2s .c o m*/ String[] strResult = new String[seriesInfo.size()]; seriesInfo.toArray(strResult); List<SeriesData> seriesData = JnlpArgumentsParser.parse(strResult); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception ex) { ex.printStackTrace(); } DownloadManagerFrame manager = new DownloadManagerFrame(true, userId, password, includeAnnotation, seriesData, serverUrl, noOfRetry); manager.setTitle(winTitle); String os = System.getProperty("os.name").toLowerCase(); if (os.startsWith("mac")) { //manager.setDefaultDownloadDir("Please select a directory for downloading images."); } else manager.setDefaultDownloadDir(System.getProperty("user.home") + File.separator + "Desktop"); manager.setVisible(true); if (frame != null) frame.setVisible(false); } catch (Exception ex) { ex.printStackTrace(); } }
From source file:net.sf.dsig.DSApplet.java
private void initSwing() { try {/*w ww.j a v a 2 s .c om*/ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { logger.warn("UIManager.setLookAndFeel() failed", e); } JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.LINE_AXIS)); panel.setBackground(Color.decode(backgroundColor)); add(panel); boolean lockPrinted = false; if (formId != null) { Icon lockIcon = new ImageIcon(getClass().getResource("/icons/lock.png")); lockPrinted = true; JButton button = new JButton("Sign", lockIcon); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { available.acquireUninterruptibly(); try { signInternal(formId, null); } catch (Exception ex) { logger.error("Internal sign failed", e); } finally { available.release(); } } }); panel.add(button); } Icon infoIcon = new ImageIcon(getClass().getResource(lockPrinted ? "/icons/info.png" : "/icons/lock.png")); JLabel infoLabel = new JLabel(infoIcon); infoLabel.addMouseListener(new MouseListener() { public void mouseClicked(MouseEvent e) { JOptionPane.showMessageDialog(null, printInfoMessage()); } public void mouseEntered(MouseEvent e) { /* NOOP */ } public void mouseExited(MouseEvent e) { /* NOOP */ } public void mousePressed(MouseEvent e) { /* NOOP */ } public void mouseReleased(MouseEvent e) { /* NOOP */ } }); panel.add(infoLabel); }
From source file:org.sbml.bargraph.MainWindow.java
/** * Configure the windows for platform the user is running. *//*from ww w. j av a2s . c om*/ 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 {/*from w w w. j av a 2 s. co m*/ 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); }