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:ca.sfu.federation.Application.java
/** * Start the application./*from w ww .j a v a2 s . c om*/ */ @Override public void run() { logger.log(Level.INFO, "Starting application"); // set the look and feel options try { logger.log(Level.FINE, "Setting look and feel options"); UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); JPopupMenu.setDefaultLightWeightPopupEnabled(false); LookAndFeelUtil.removeAllSplitPaneBorders(); } catch (Exception e) { String stack = ExceptionUtils.getFullStackTrace(e); logger.log(Level.WARNING, "Could not set look and feel options\n\n{0}", stack); } // create the main application frame logger.log(Level.FINE, "Creating main application frame"); frame = new ApplicationFrame(); // show the application frame.setVisible(true); }
From source file:lookandfeel.LookAndFeelDemo.java
private static void initLookAndFeel() { String lookAndFeel = null;//from ww w. j a v a2 s . c o m if (LOOKANDFEEL != null) { if (LOOKANDFEEL.equals("Metal")) { lookAndFeel = UIManager.getCrossPlatformLookAndFeelClassName(); // an alternative way to set the Metal L&F is to replace the // previous line with: // lookAndFeel = "javax.swing.plaf.metal.MetalLookAndFeel"; } else if (LOOKANDFEEL.equals("System")) { lookAndFeel = UIManager.getSystemLookAndFeelClassName(); } else if (LOOKANDFEEL.equals("Motif")) { lookAndFeel = "com.sun.java.swing.plaf.motif.MotifLookAndFeel"; } else if (LOOKANDFEEL.equals("GTK")) { lookAndFeel = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"; } else { System.err.println("Unexpected value of LOOKANDFEEL specified: " + LOOKANDFEEL); lookAndFeel = UIManager.getCrossPlatformLookAndFeelClassName(); } try { UIManager.setLookAndFeel(lookAndFeel); // If L&F = "Metal", set the theme if (LOOKANDFEEL.equals("Metal")) { if (THEME.equals("DefaultMetal")) MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme()); else if (THEME.equals("Ocean")) MetalLookAndFeel.setCurrentTheme(new OceanTheme()); else MetalLookAndFeel.setCurrentTheme(new TestTheme()); UIManager.setLookAndFeel(new MetalLookAndFeel()); } } catch (ClassNotFoundException e) { System.err.println("Couldn't find class for specified look and feel:" + lookAndFeel); System.err.println("Did you include the L&F library in the class path?"); System.err.println("Using the default look and feel."); } catch (UnsupportedLookAndFeelException e) { System.err.println("Can't use the specified look and feel (" + lookAndFeel + ") on this platform."); System.err.println("Using the default look and feel."); } catch (Exception e) { System.err.println("Couldn't get specified look and feel (" + lookAndFeel + "), for some reason."); System.err.println("Using the default look and feel."); e.printStackTrace(); } } }
From source file:edu.harvard.i2b2.eclipse.plugins.patientMapping.views.PatientMappingView.java
/** * This is a callback that will allow us to create the viewer and initialize * it.//from w w w . j a v a 2s . c om */ @Override public void createPartControl(Composite parent) { log.info("Patient Mapping plugin version 1.7.0"); timelineComposite = parent; if (!(UserInfoBean.getInstance().isRoleInProject("DATA_LDS"))) { new NoAccessComposite(parent, SWT.NONE); return; } //explorer = new MainComposite(parent, false);*/ Composite composite = new Composite(parent, SWT.EMBEDDED); /* 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(composite); Panel runPanel = new Panel(new BorderLayout()); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { System.out.println("Error setting native LAF: " + e); } runFrame.add(runPanel); JRootPane runRoot = new JRootPane(); runPanel.add(runRoot); oAwtContainer = runRoot.getContentPane(); runTreePanel = new PatientMappingJPanel(oAwtContainer);//PreviousQueryPanel(this); //runTreePanel.setBackground(Color.BLUE); oAwtContainer.add(runTreePanel); // Setup help context PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, PATIENTMAPPING_VIEW_CONTEXT_ID); addHelpButtonToToolBar(); }
From source file:LookAndFeelDemo.java
private static void initLookAndFeel() { String lookAndFeel = null;//from w ww .j av a 2 s . c o m if (LOOKANDFEEL != null) { if (LOOKANDFEEL.equals("Metal")) { lookAndFeel = UIManager.getCrossPlatformLookAndFeelClassName(); // an alternative way to set the Metal L&F is to replace the // previous line with: // lookAndFeel = "javax.swing.plaf.metal.MetalLookAndFeel"; } else if (LOOKANDFEEL.equals("System")) { lookAndFeel = UIManager.getSystemLookAndFeelClassName(); } else if (LOOKANDFEEL.equals("Motif")) { lookAndFeel = "com.sun.java.swing.plaf.motif.MotifLookAndFeel"; } else if (LOOKANDFEEL.equals("GTK")) { lookAndFeel = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"; } else { System.err.println("Unexpected value of LOOKANDFEEL specified: " + LOOKANDFEEL); lookAndFeel = UIManager.getCrossPlatformLookAndFeelClassName(); } try { UIManager.setLookAndFeel(lookAndFeel); // If L&F = "Metal", set the theme if (LOOKANDFEEL.equals("Metal")) { if (THEME.equals("DefaultMetal")) MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme()); else if (THEME.equals("Ocean")) MetalLookAndFeel.setCurrentTheme(new OceanTheme()); else MetalLookAndFeel.setCurrentTheme(new TestTheme()); UIManager.setLookAndFeel(new MetalLookAndFeel()); } } catch (ClassNotFoundException e) { System.err.println("Couldn't find class for specified look and feel:" + lookAndFeel); System.err.println("Did you include the L&F library in the class path?"); System.err.println("Using the default look and feel."); } catch (UnsupportedLookAndFeelException e) { System.err.println("Can't use the specified look and feel (" + lookAndFeel + ") on this platform."); System.err.println("Using the default look and feel."); } catch (Exception e) { System.err.println("Couldn't get specified look and feel (" + lookAndFeel + "), for some reason."); System.err.println("Using the default look and feel."); e.printStackTrace(); } } }
From source file:org.astrojournal.gui.AJMainGUI.java
/** * A simple main to start AJMiniGUI./*w ww . jav a 2 s.c om*/ * * @param args * The command line arguments */ public static void main(String args[]) { // Initialise dependency injection with Spring ApplicationContext context = new ClassPathXmlApplicationContext("META-INF/aj_spring_default_context.xml"); BeanFactory factory = context; final Configuration config = (Configuration) factory.getBean("configuration"); final Generator generator = (Generator) factory.getBean("generator"); // Note Nimbus does not seem to show the vertical scroll bar if there is // too much text.. try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { log.error(e, e); } // enable anti-aliased text: System.setProperty("awt.useSystemAAFontSettings", "gasp"); System.setProperty("swing.aatext", "true"); // invoke the application and make it visible java.awt.EventQueue.invokeLater(new Runnable() { @Override public void run() { new AJMainGUI(generator, config).setVisible(true); } }); }
From source file:burlov.ultracipher.swing.SwingGuiApplication.java
static void initLAF() { try {//from w w w . j a va 2s . c o m UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e1) { e1.printStackTrace(); } try { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (Exception e) { e.printStackTrace(); } }
From source file:Formulario.CapturaHuella.java
public CapturaHuella() { try {//from ww w . j a va 2s . c o m UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { JOptionPane.showMessageDialog(null, "Imposible modificar el tema visual", "Lookandfeel invlido.", JOptionPane.ERROR_MESSAGE); } initComponents(); //Carga los componentes del JPanel txtArea.setEditable(false); //agreagr logo y nombre en la barra superior setIconImage(new ImageIcon(getClass().getResource("/img/logoCrecic.jpg")).getImage()); setTitle("Crecic S.A"); }
From source file:edu.harvard.i2b2.eclipse.plugins.adminTool.views.AdminToolView.java
/** * This is a callback that will allow us to create the viewer and initialize * it.// www .j a v a2 s .c o m */ @Override public void createPartControl(Composite parent) { log.info("Patient Mapping plugin version 1.7.0"); timelineComposite = parent; boolean isManager = false; ArrayList<String> roles = (ArrayList<String>) UserInfoBean.getInstance().getProjectRoles(); for (String param : roles) { if (param.equalsIgnoreCase("manager")) { isManager = true; break; } } if (!(UserInfoBean.getInstance().isRoleInProject("DATA_PROT")) || !isManager) { new NoAccessComposite(parent, SWT.NONE); return; } //explorer = new MainComposite(parent, false);*/ Composite composite = new Composite(parent, SWT.EMBEDDED); /* 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(composite); Panel runPanel = new Panel(new BorderLayout()); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { System.out.println("Error setting native LAF: " + e); } runFrame.add(runPanel); JRootPane runRoot = new JRootPane(); runPanel.add(runRoot); oAwtContainer = runRoot.getContentPane(); runTreePanel = new AdminToolJPanel();//PatientMappingJPanel();//PreviousQueryPanel(this); //runTreePanel.setBackground(Color.BLUE); oAwtContainer.add(runTreePanel); // Setup help context PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, ADMINTOOL_VIEW_CONTEXT_ID); addHelpButtonToToolBar(); }
From source file:ProtocolRunner.java
/** Creates new form ProtocolRunner */ public ProtocolRunner() { // set the native look and feel try{//ww w .ja v a 2s .c om UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName()); }catch(Exception e) {} initComponents(); // size it so that it appears full screen Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); this.setSize(screen.width, screen.height); this.pack(); this.setExtendedState(Frame.MAXIMIZED_BOTH); }
From source file:edu.harvard.i2b2.eclipse.plugins.query.views.QueryView.java
/** * This is a callback that will allow us to create the viewer and initialize * it.//from w w w . j a va 2s .c o m */ @Override public void createPartControl(Composite parent) { // setup context help PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, QUERY_VIEW_CONTEXT_ID); addHelpButtonToToolBar(); log.info("Query Tool plugin version 1.7.0"); GridLayout topGridLayout = new GridLayout(1, false); topGridLayout.numColumns = 1; topGridLayout.marginWidth = 2; topGridLayout.marginHeight = 2; parent.setLayout(topGridLayout); queryComposite = new Composite(parent, SWT.NONE); queryComposite.setLayout(new FillLayout(SWT.VERTICAL)); GridData gridData2 = new GridData(); gridData2.horizontalAlignment = GridData.FILL; gridData2.verticalAlignment = GridData.FILL; gridData2.grabExcessHorizontalSpace = true; gridData2.grabExcessVerticalSpace = true; queryComposite.setLayoutData(gridData2); Composite rightComp = new Composite(queryComposite, SWT.BORDER | SWT.EMBEDDED | SWT.DragDetect); /* Create and setting up frame */ ////for mac fix //if ( System.getProperty("os.name").toLowerCase().startsWith("mac")) //SWT_AWT.embeddedFrameClass = "sun.lwawt.macosx.CViewEmbeddedFrame"; Frame frame = SWT_AWT.new_Frame(rightComp); Panel panel = new Panel(new BorderLayout()); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { System.out.println("Error setting native LAF: " + e); } frame.add(panel); JRootPane root = new JRootPane(); panel.add(root); oAwtContainer = root.getContentPane(); if (mode_ == 0) { queryToolPanel = new QueryToolInvestigatorPanel(this); } else { queryToolPanel = new QueryToolPanel(); } oAwtContainer.add(queryToolPanel); }