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:edu.harvard.i2b2.eclipse.plugins.admin.utilities.views.PatientCountView.java
private void audit() { //System.out.println(item.getText()+" item selected"); //group.setVisible(false); //composite1.setVisible(true); if (right != null && !right.isDisposed()) { right.dispose();//w w w .j a v a 2 s . com right = null; } right = new Composite(composite, SWT.NONE); GridLayout rightLayout1 = new GridLayout(); GridData rightLData = new GridData(); rightLData.grabExcessHorizontalSpace = true; rightLData.grabExcessVerticalSpace = true; rightLData.horizontalAlignment = GridData.FILL; rightLData.verticalAlignment = GridData.FILL; right.setLayoutData(rightLData); right.setLayout(rightLayout1); GridData composite1LData = new GridData(); composite1LData.grabExcessHorizontalSpace = true; composite1LData.grabExcessVerticalSpace = true; composite1LData.horizontalAlignment = GridData.FILL; composite1LData.verticalAlignment = GridData.FILL; composite1 = new Composite(right, SWT.EMBEDDED); composite1.setLayoutData(composite1LData); /* Create and setting up frame */ ////for mac fix //if ( System.getProperty("os.name").toLowerCase().startsWith("mac")) // SWT_AWT.embeddedFrameClass = "sun.lwawt.macosx.CViewEmbeddedFrame"; Frame runFrame = SWT_AWT.new_Frame(composite1); Panel runPanel = new Panel(new BorderLayout()); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e1) { System.out.println("Error setting native LAF: " + e1); } runFrame.add(runPanel); JRootPane runRoot = new JRootPane(); runPanel.add(runRoot); java.awt.Container oAwtContainer = runRoot.getContentPane(); AdminToolMonitorJPanel runTreePanel = new AdminToolMonitorJPanel();//PatientMappingJPanel();//PreviousQueryPanel(this); //runTreePanel.setBackground(Color.BLUE); oAwtContainer.add(runTreePanel); //oAwtContainer.setVisible(true); //oAwtContainer.setSize(500, 500); //right.layout(true); //right.setVisible(true); //right.update(); composite.layout(true); //composite.setVisible(true); //composite.update(); }
From source file:it.cnr.icar.eric.client.ui.swing.RegistryBrowser.java
public void setLocale(Locale locale) { super.setLocale(locale); Locale oldLocale = Locale.getDefault(); Locale.setDefault(locale);//from w ww. j av a 2 s .c om resourceBundle = JavaUIResourceBundle.getInstance(locale); firePropertyChange(PROPERTY_LOCALE, oldLocale, locale); applyComponentOrientation(ComponentOrientation.getOrientation(getLocale())); SwingUtilities.updateComponentTreeUI(this); // Setting the look and feel is seemingly the only way to get // the JOptionPane.showConfirmDialog in exitApplication() to // use the correct button text for the new locale. try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception ex) { } }
From source file:com.t3.client.TabletopTool.java
public static void main(String[] args) { if (MAC_OS_X) { // On OSX the menu bar at the top of the screen can be enabled at any time, but the // title (ie. name of the application) has to be set before the GUI is initialized (by // creating a frame, loading a splash screen, etc). So we do it here. System.setProperty("apple.laf.useScreenMenuBar", "true"); System.setProperty("com.apple.mrj.application.apple.menu.about.name", "About TabletopTool..."); System.setProperty("apple.awt.brushMetalLook", "true"); }/*from ww w . j a va 2 s .c o m*/ // Before anything else, create a place to store all the data try { AppUtil.getAppHome(); } catch (Throwable t) { t.printStackTrace(); // Create an empty frame so there's something to click on if the dialog goes in the background JFrame frame = new JFrame(); SwingUtil.centerOnScreen(frame); frame.setVisible(true); String errorCreatingDir = "Error creating data directory"; log.error(errorCreatingDir, t); JOptionPane.showMessageDialog(frame, t.getMessage(), errorCreatingDir, JOptionPane.ERROR_MESSAGE); System.exit(1); } verifyJavaVersion(); configureLogging(); // System properties System.setProperty("swing.aatext", "true"); // System.setProperty("sun.java2d.opengl", "true"); final SplashScreen splash = new SplashScreen(SPLASH_IMAGE, getVersion()); splash.showSplashScreen(); // Protocol handlers // cp:// is registered by the RPTURLStreamHandlerFactory constructor (why?) RPTURLStreamHandlerFactory factory = new RPTURLStreamHandlerFactory(); factory.registerProtocol("asset", new AssetURLStreamHandler()); URL.setURLStreamHandlerFactory(factory); MacroEngine.initialize(); configureJide(); //TODO find out how to not call this twice without destroying error windows final Toolkit tk = Toolkit.getDefaultToolkit(); tk.getSystemEventQueue().push(new T3EventQueue()); // LAF try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); configureJide(); if (WINDOWS) LookAndFeelFactory.installJideExtension(LookAndFeelFactory.XERTO_STYLE); else LookAndFeelFactory.installJideExtension(); if (MAC_OS_X) { macOSXicon(); } menuBar = new AppMenuBar(); } catch (Exception e) { TabletopTool.showError("msg.error.lafSetup", e); System.exit(1); } /** * This is a tweak that makes the Chinese version work better. * <p> * Consider reviewing <a * href="http://en.wikipedia.org/wiki/CJK_characters" * >http://en.wikipedia.org/wiki/CJK_characters</a> before making * changes. And http://www.scarfboy.com/coding/unicode-tool is also a * really cool site. */ if (Locale.CHINA.equals(Locale.getDefault())) { // The following font name appears to be "Sim Sun". It can be downloaded // from here: http://fr.cooltext.com/Fonts-Unicode-Chinese Font f = new Font("\u65B0\u5B8B\u4F53", Font.PLAIN, 12); FontUIResource fontRes = new FontUIResource(f); for (Enumeration<Object> keys = UIManager.getDefaults().keys(); keys.hasMoreElements();) { Object key = keys.nextElement(); Object value = UIManager.get(key); if (value instanceof FontUIResource) UIManager.put(key, fontRes); } } // Draw frame contents on resize tk.setDynamicLayout(true); EventQueue.invokeLater(new Runnable() { @Override public void run() { initialize(); EventQueue.invokeLater(new Runnable() { @Override public void run() { clientFrame.setVisible(true); splash.hideSplashScreen(); EventQueue.invokeLater(new Runnable() { @Override public void run() { postInitialize(); } }); } }); } }); // new Thread(new HeapSpy()).start(); }
From source file:net.rptools.maptool.client.MapTool.java
public static void main(String[] args) { if (MAC_OS_X) { // On OSX the menu bar at the top of the screen can be enabled at any time, but the // title (ie. name of the application) has to be set before the GUI is initialized (by // creating a frame, loading a splash screen, etc). So we do it here. System.setProperty("apple.laf.useScreenMenuBar", "true"); System.setProperty("com.apple.mrj.application.apple.menu.about.name", "About MapTool..."); System.setProperty("apple.awt.brushMetalLook", "true"); }/*from w ww. ja va2 s.co m*/ // Before anything else, create a place to store all the data try { AppUtil.getAppHome(); } catch (Throwable t) { t.printStackTrace(); // Create an empty frame so there's something to click on if the dialog goes in the background JFrame frame = new JFrame(); SwingUtil.centerOnScreen(frame); frame.setVisible(true); String errorCreatingDir = "Error creating data directory"; log.error(errorCreatingDir, t); JOptionPane.showMessageDialog(frame, t.getMessage(), errorCreatingDir, JOptionPane.ERROR_MESSAGE); System.exit(1); } verifyJavaVersion(); configureLogging(); // System properties System.setProperty("swing.aatext", "true"); // System.setProperty("sun.java2d.opengl", "true"); final SplashScreen splash = new SplashScreen(SPLASH_IMAGE, getVersion()); splash.showSplashScreen(); // Protocol handlers // cp:// is registered by the RPTURLStreamHandlerFactory constructor (why?) RPTURLStreamHandlerFactory factory = new RPTURLStreamHandlerFactory(); factory.registerProtocol("asset", new AssetURLStreamHandler()); URL.setURLStreamHandlerFactory(factory); final Toolkit tk = Toolkit.getDefaultToolkit(); tk.getSystemEventQueue().push(new MapToolEventQueue()); // LAF try { // If we are running under Mac OS X then save native menu bar look & feel components // Note the order of creation for the AppMenuBar, this specific chronology // allows the system to set up system defaults before we go and modify things. // That is, please don't move these lines around unless you test the result on windows and mac String lafname; if (MAC_OS_X) { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); menuBar = new AppMenuBar(); lafname = "net.rptools.maptool.client.TinyLookAndFeelMac"; UIManager.setLookAndFeel(lafname); macOSXicon(); } // If running on Windows based OS, CJK font is broken when using TinyLAF. // else if (WINDOWS) { // UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); // menuBar = new AppMenuBar(); // } else { lafname = "de.muntjak.tinylookandfeel.TinyLookAndFeel"; UIManager.setLookAndFeel(lafname); menuBar = new AppMenuBar(); } // After the TinyLAF library is initialized, look to see if there is a Default.theme // in our AppHome directory and load it if there is. Unfortunately, changing the // search path for the default theme requires subclassing TinyLAF and because // we have both the original and a Mac version that gets cumbersome. (Really // the Mac version should use the default and then install the keystroke differences // but what we have works and I'm loathe to go playing with it at 1.3b87 -- yes, 87!) File f = AppUtil.getAppHome("config"); if (f.exists()) { File f2 = new File(f, "Default.theme"); if (f2.exists()) { if (Theme.loadTheme(f2)) { // re-install the Tiny Look and Feel UIManager.setLookAndFeel(lafname); // Update the ComponentUIs for all Components. This // needs to be invoked for all windows. //SwingUtilities.updateComponentTreeUI(rootComponent); } } } com.jidesoft.utils.Lm.verifyLicense("Trevor Croft", "rptools", "5MfIVe:WXJBDrToeLWPhMv3kI2s3VFo"); LookAndFeelFactory.addUIDefaultsCustomizer(new LookAndFeelFactory.UIDefaultsCustomizer() { public void customize(UIDefaults defaults) { // Remove red border around menus defaults.put("PopupMenu.foreground", Color.lightGray); } }); LookAndFeelFactory.installJideExtension(LookAndFeelFactory.XERTO_STYLE); /**************************************************************************** * For TinyLAF 1.3.04 this is how the color was changed for a * button. */ // Theme.buttonPressedColor[Theme.style] = new ColorReference(Color.gray); /**************************************************************************** * And this is how it's done in TinyLAF 1.4.0 (no idea about the * intervening versions). */ Theme.buttonPressedColor = new SBReference(Color.GRAY, 0, -6, SBReference.SUB3_COLOR); configureJide(); } catch (Exception e) { MapTool.showError("msg.error.lafSetup", e); System.exit(1); } /** * This is a tweak that makes the Chinese version work better. * <p> * Consider reviewing <a * href="http://en.wikipedia.org/wiki/CJK_characters" * >http://en.wikipedia.org/wiki/CJK_characters</a> before making * changes. And http://www.scarfboy.com/coding/unicode-tool is also a * really cool site. */ if (Locale.CHINA.equals(Locale.getDefault())) { // The following font name appears to be "Sim Sun". It can be downloaded // from here: http://fr.cooltext.com/Fonts-Unicode-Chinese Font f = new Font("\u65B0\u5B8B\u4F53", Font.PLAIN, 12); FontUIResource fontRes = new FontUIResource(f); for (Enumeration<Object> keys = UIManager.getDefaults().keys(); keys.hasMoreElements();) { Object key = keys.nextElement(); Object value = UIManager.get(key); if (value instanceof FontUIResource) UIManager.put(key, fontRes); } } // Draw frame contents on resize tk.setDynamicLayout(true); EventQueue.invokeLater(new Runnable() { public void run() { initialize(); EventQueue.invokeLater(new Runnable() { public void run() { clientFrame.setVisible(true); splash.hideSplashScreen(); EventQueue.invokeLater(new Runnable() { public void run() { postInitialize(); } }); } }); } }); // new Thread(new HeapSpy()).start(); }
From source file:it.cnr.icar.eric.client.ui.swing.RegistryBrowser.java
/** * Create the GUI and show it. For thread safety, this method should be * invoked from the event-dispatching thread. */// w ww . ja va 2s . co m private static void createAndShowGUI() { try { String callbackHandlerClassName = ProviderProperties.getInstance().getProperty( "jaxr-ebxml.security.jaas.callbackHandlerClassName", System.getProperty("jaxr-ebxml.security.jaas.callbackHandlerClassName")); if ((callbackHandlerClassName == null) || (callbackHandlerClassName.length() == 0)) { System.setProperty("jaxr-ebxml.security.jaas.callbackHandlerClassName", "it.cnr.icar.eric.client.xml.registry.jaas.DialogAuthenticationCallbackHandler"); } // By default JDialog and JFrame will not follow theme changes. // JDialog.setDefaultLookAndFeelDecorated(true); // JFrame.setDefaultLookAndFeelDecorated(true); // I18N: Do not localize next statement. System.setProperty("sun.awt.noerasebackground", "true"); MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme()); // I18N: Do not localize next statement. UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); // Create a new instance of our application's frame, and make it // visible. RegistryBrowser browser = getInstance(); browser.pack(); Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); browser.setBounds(0, 0, (int) (dim.getWidth()), (int) (dim.getHeight())); browser.setVisible(true); } catch (Throwable t) { log.fatal(t); t.printStackTrace(); // Ensure the application exits with an error condition. System.exit(1); } }
From source file:gov.noaa.ncdc.iosp.avhrr.util.AvhrrLevel1B2Netcdf.java
/** * @param args/*from w ww . j a v a 2 s. c o m*/ * the command line arguments */ public static void main(String args[]) throws Exception { // create the Options object Options options = new Options(); options.addOption(OPTION_NOGUI, false, "command line mode"); options.addOption(OPTION_ALLVAR, false, "Process all channels"); options.addOption(OPTION_CH1, false, "Process channel 1"); options.addOption(OPTION_CH2, false, "Process channel 2"); options.addOption(OPTION_CH3, false, "Process channel 3"); options.addOption(OPTION_CH4, false, "Process channel 4"); options.addOption(OPTION_CH5, false, "Process channel 5"); options.addOption(OPTION_DEFAULT, false, "Output All Channels, Brightness Temperature and Latitude and Longitude"); options.addOption(OPTION_TEMP, false, "Output calibrated temperatures/albedos"); options.addOption(OPTION_RAW, false, "Output raw values"); options.addOption(OPTION_RADIANCE, false, "Output radiance values"); options.addOption(OPTION_LATLON, false, "Output latitude and longitude"); options.addOption(OPTION_ALLVAR, false, "Output all variables)"); options.addOption(OPTION_CLOBBER, false, "Overwrite existing netCDF file."); options.addOption(OPTION_CALIBRATION, false, "Output calibration variables"); options.addOption(OPTION_QUALITY, false, "Output quality variables."); options.addOption(OPTION_METADATA, false, "Output metadata variables."); options.addOption("memory", false, "java heap space."); Option logOption = new Option("logFile", true, "Send output to file"); options.addOption(logOption); Option outdirOption = new Option("outputdir", true, "Output Directory."); options.addOption(outdirOption); // 2nd way is by creating an Option and then adding it Option timeOption = new Option(OPTION_AVHRR, true, "Process the Level1B file"); timeOption.setRequired(false); options.addOption(timeOption); // now lets parse the input CommandLineParser parser = new BasicParser(); CommandLine cmd; try { cmd = parser.parse(options, args); } catch (ParseException pe) { usage(options); return; } // now lets interrogate the options and execute the relevant parts if (cmd.hasOption(OPTION_NOGUI)) { // process command line args - need to refactor this (doing this // twice--BAD!!!!!) List<String> list = processCommandLineArgs(cmd); String file = cmd.getOptionValue(OPTION_AVHRR); if (null == file) { System.out.println("You must specify a file to convert!! missing -avhrr argument"); usage(options); return; } String outdir = cmd.getOptionValue("outputdir"); if (null == outdir || outdir.trim().length() < 1) { File f = new File("."); outdir = f.getAbsolutePath(); } // try { Avhrr2Netcdf.convert(file, list, outdir); // } catch (Exception e) { // System.out.println("this blew up"); // TODO Auto-generated catch block // e.printStackTrace(); // } } else { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { UIManager.LookAndFeelInfo[] info = UIManager.getInstalledLookAndFeels(); for (int i = 0; i < info.length; i++) { // Get the name of the look and feel that is suitable // for // display to the user String className = info[i].getClassName(); } String javaLF = UIManager.getSystemLookAndFeelClassName(); try { // UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel"); UIManager.setLookAndFeel(javaLF); } catch (ClassNotFoundException e) { // log.error(e.getMessage()); } catch (InstantiationException e) { // log.error(e.getMessage()); } catch (IllegalAccessException e) { // log.error(e.getMessage()); } catch (UnsupportedLookAndFeelException e) { // log.error(e.getMessage()); } mFrame = new AvhrrLevel1B2Netcdf(); mFrame.setVisible(true); } }); } }
From source file:de.whiledo.iliasdownloader2.swing.service.MainController.java
@SuppressWarnings("unchecked") protected void changeLookAndFeel() { final JDialog dialog = new JDialog(mainFrame, "Design ndern"); dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); Collection<TwoObjectsX<String, String>> lookAndFeels = FunctionsX.asList( new TwoObjectsX<String, String>("Metal", UIManager.getCrossPlatformLookAndFeelClassName()), new TwoObjectsX<String, String>("Betriebssystem Standard", UIManager.getSystemLookAndFeelClassName()), new TwoObjectsX<String, String>("Nimbus", NimbusLookAndFeel.class.getName())); dialog.setLayout(new GridLayout(0, 1)); ButtonGroup b = new ButtonGroup(); for (final TwoObjectsX<String, String> lookAndFeel : lookAndFeels) { JRadioButton rb = new JRadioButton(lookAndFeel.getObjectA()); if (iliasProperties.getLookAndFeel().equals(lookAndFeel.getObjectB())) { rb.setSelected(true);/*from ww w . j a v a 2 s. co m*/ } rb.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { UIManager.setLookAndFeel(lookAndFeel.getObjectB()); iliasProperties.setLookAndFeel(lookAndFeel.getObjectB()); saveProperties(iliasProperties); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e1) { showError("Fehler beim ndern des Designs", e1); } SwingUtilities.updateComponentTreeUI(mainFrame); SwingUtilities.updateComponentTreeUI(dialog); } }); b.add(rb); dialog.add(rb); } dialog.pack(); dialog.setLocationRelativeTo(mainFrame); dialog.setVisible(true); }
From source file:de.nmichael.efa.Daten.java
public static void iniGUI() { if (Logger.isTraceOn(Logger.TT_CORE, 9) || Logger.isDebugLoggingActivatedByCommandLine()) { Logger.log(Logger.DEBUG, Logger.MSG_CORE_STARTUPINITIALIZATION, "iniGUI()"); }/* w w w.j a v a2 s. com*/ if (!isGuiAppl()) { return; } iniScreenSize(); // Look&Feel if (Daten.efaConfig != null) { // is null for applDRV try { if (Daten.efaConfig.getValueLookAndFeel().length() == 0) { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } else { UIManager.setLookAndFeel(Daten.efaConfig.getValueLookAndFeel()); } } catch (Exception e) { Logger.log(Logger.WARNING, Logger.MSG_WARN_CANTSETLOOKANDFEEL, International.getString("Konnte Look&Feel nicht setzen") + ": " + e.toString()); } } // Look&Feel specific Work-Arounds try { lookAndFeel = UIManager.getLookAndFeel().getClass().toString(); if (!lookAndFeel.endsWith("MetalLookAndFeel")) { // to make PopupMenu's work properly and not swallow the next MousePressed Event, see: // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6753637 Dialog.getUiDefaults().put("PopupMenu.consumeEventOnClose", false); } Color buttonFocusColor = (Daten.efaConfig != null ? Daten.efaConfig.getLafButtonFocusColor() : null); if (buttonFocusColor != null) { // colored square around text of selected button Dialog.getUiDefaults().put("Button.focus", new ColorUIResource(buttonFocusColor)); } // allow users to press buttons by hitting ENTER (and not just SPACE) Dialog.getUiDefaults().put("Button.focusInputMap", new javax.swing.UIDefaults.LazyInputMap(new Object[] { "ENTER", "pressed", "released ENTER", "released", "SPACE", "pressed", "released SPACE", "released" })); } catch (Exception e) { Logger.log(Logger.WARNING, Logger.MSG_WARN_CANTSETLOOKANDFEEL, "Failed to apply LookAndFeel Workarounds: " + e.toString()); } // Font Size if (applID == APPL_EFABH) { try { Dialog.setGlobalFontSize(Daten.efaConfig.getValueEfaDirekt_fontSize(), Daten.efaConfig.getValueEfaDirekt_fontStyle()); } catch (Exception e) { Logger.log(Logger.WARNING, Logger.MSG_WARN_CANTSETFONTSIZE, International.getString("Schriftgre konnte nicht gendert werden") + ": " + e.toString()); } } }
From source file:iad_zad3.gui.MainWindow.java
private static void initLookAndFeel() { String lookAndFeel = null;//from w ww .j av a 2 s .com lookAndFeel = UIManager.getSystemLookAndFeelClassName(); try { UIManager.setLookAndFeel(lookAndFeel); } catch (ClassNotFoundException | UnsupportedLookAndFeelException e) { } catch (Exception e) { //TODO :) } }
From source file:Installer.java
public static void main(String[] args) { try {/* w w w . j a v a 2 s . com*/ // Set System L&F UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { } try { javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); } catch (Exception e) { e.printStackTrace(); } }