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:Data.java
/** * @param args the command line arguments *//*from w ww . ja v a 2 s. c o 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 (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(Data.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Data.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Data.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Data.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ EventQueue.invokeLater(new Runnable() { public void run() { try { new Data().setVisible(true); } catch (ClassNotFoundException | IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); }
From source file:org.astrojournal.gui.AJMainGUI.java
/** * A simple main to start AJMiniGUI./*from ww w . j a v a 2 s . c o m*/ * * @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:lookandfeel.LookAndFeelDemo.java
private static void initLookAndFeel() { String lookAndFeel = null;//from ww w . j a v a 2 s . c om 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:GUI.DashbordAdminFrame.java
/** * Creates new form DashbordAdminFrame//from www .ja v a 2s . com */ public DashbordAdminFrame() throws UnsupportedLookAndFeelException, ParseException, java.text.ParseException { UIManager.setLookAndFeel(new SyntheticaBlueLightLookAndFeel()); initComponents(); }
From source file:burlov.ultracipher.swing.SwingGuiApplication.java
static void initLAF() { try {/*from w ww . j a v a 2 s . 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 ava 2s .co 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.//from ww w . j a va 2 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{//from w w w. ja va 2 s. c o m 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 ava2s . com */ @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); }
From source file:lookandfeel.SynthDialog.java
private static void initLookAndFeel() { SynthLookAndFeel lookAndFeel = new SynthLookAndFeel(); try {/* w w w .ja v a 2s . c o m*/ // SynthLookAndFeel load() method throws a checked exception // (java.text.ParseException) so it must be handled lookAndFeel.load(SynthDialog.class.getResourceAsStream("synthDemo.xml"), SynthDialog.class); UIManager.setLookAndFeel(lookAndFeel); } 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(); } }