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:brainflow.app.presentation.controls.FileObjectGroupSelector.java
public static void main(String[] args) { try {/*from w w w. java 2s . c o m*/ com.jidesoft.utils.Lm.verifyLicense("UIN", "BrainFlow", "S5XiLlHH0VReaWDo84sDmzPxpMJvjP3"); //com.jidesoft.plaf.LookAndFeelFactory.installDefaultLookAndFeel(); //LookAndFeelFactory.installJideExtension(LookAndFeelFactory.OFFICE2007_STYLE); UIManager.setLookAndFeel(new NimbusLookAndFeel()); JFrame jf = new JFrame(); FileObjectGroupSelector selector = new FileObjectGroupSelector( VFS.getManager().resolveFile("c:/javacode")); ButtonPanel buttonPanel = new ButtonPanel(SwingConstants.RIGHT); buttonPanel.setSizeConstraint(ButtonPanel.NO_LESS_THAN); JButton okButton = new JButton("OK"); JButton resetButton = new JButton("Cancel"); buttonPanel.addButton(okButton, ButtonPanel.AFFIRMATIVE_BUTTON); buttonPanel.addButton(resetButton, ButtonPanel.CANCEL_BUTTON); buttonPanel.setBorder(BorderFactory.createEmptyBorder(0, 8, 8, 8)); JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); panel.add(selector, BorderLayout.CENTER); panel.add(buttonPanel, BorderLayout.SOUTH); panel.setMinimumSize(new Dimension(800, 100)); jf.add(panel, BorderLayout.CENTER); jf.pack(); jf.setVisible(true); } catch (Exception e) { e.printStackTrace(); } }
From source file:DefaultsDisplay.java
/** Creates a new instance of DefaultsDisplayer */ public DefaultsDisplay() { defaultsTablesMap = new HashMap<String, JComponent>(); try {//from ww w . j a va 2 s. c o m UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); if (System.getProperty("os.name").equals("Mac OS X")) { OSXLookAndFeelName = UIManager.getLookAndFeel().getName(); } } catch (Exception ex) { // better work :-) } setLayout(new BorderLayout()); JPanel controls = new JPanel(); controls.add(createLookAndFeelControl()); controls.add(createFilterControl()); add(controls, BorderLayout.NORTH); tabPane = new JTabbedPane(); add(tabPane, BorderLayout.CENTER); addDefaultsTab(); }
From source file:components.Converter.java
private static void initLookAndFeel() { String lookAndFeel = null;//from w w w .java 2 s .co m if (LOOKANDFEEL != null) { if (LOOKANDFEEL.equals("Metal")) { lookAndFeel = UIManager.getCrossPlatformLookAndFeelClassName(); } 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+")) { //new in 1.4.2 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); } 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:library.ChartGUI.java
/** * @param args the command line arguments *///from w w w . j a va 2 s . c om 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 { UIManager.setLookAndFeel("com.jtattoo.plaf.smart.SmartLookAndFeel"); } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(ChartGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(ChartGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(ChartGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(ChartGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new ChartGUI().setVisible(true); } }); }
From source file:edu.harvard.i2b2.query.QueryC.java
/** * @param args/*from w ww. j a v a2 s .c o m*/ */ protected Control createContents(Composite parent) { //log.info("Starting Query Mode"); GridLayout topGridLayout = new GridLayout(1, false); topGridLayout.numColumns = 1; topGridLayout.marginWidth = 2; topGridLayout.marginHeight = 2; setLayout(topGridLayout); Composite queryComposite = new Composite(this, 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); // the horizontal sash form SashForm horizontalForm = new SashForm(queryComposite, SWT.HORIZONTAL); horizontalForm.setOrientation(SWT.HORIZONTAL); horizontalForm.setLayout(new GridLayout()); //left sash form SashForm leftVerticalForm = new SashForm(horizontalForm, SWT.VERTICAL); leftVerticalForm.setOrientation(SWT.VERTICAL); leftVerticalForm.setLayout(new GridLayout()); if (bWantStatusLine) { slm.createControl(this, SWT.NULL); } slm.setMessage("i2b2 Explorer Version 2.0"); slm.update(true); // Create the tab folder final TabFolder oTabFolder = new TabFolder(leftVerticalForm, SWT.NONE); // Create each tab and set its text, tool tip text, // image, and control TabItem oTreeTab = new TabItem(oTabFolder, SWT.NONE); oTreeTab.setText("Concept trees"); oTreeTab.setToolTipText("Hierarchically organized patient characteristics"); oTreeTab.setControl(getQueryTabControl(oTabFolder)); //TabItem oFindTab = new TabItem(oTabFolder, SWT.NONE); //oFindTab.setText("Find"); //oFindTab.setToolTipText("Free-form find tool for patient characteristics"); //FindTool find = new FindTool(slm); //oFindTab.setControl(find.getFindTabControl(oTabFolder)); // Select the first tab (index is zero-based) oTabFolder.setSelection(0); // Create the tab folder final TabFolder queryRunFolder = new TabFolder(leftVerticalForm, SWT.NONE); TabItem previousRunTab = new TabItem(queryRunFolder, SWT.NONE); previousRunTab.setText("Patient Sets and Previous Queries"); previousRunTab.setToolTipText("Patient Sets & Previous Queries"); final Composite composite = new Composite(queryRunFolder, SWT.EMBEDDED); previousRunTab.setControl(composite); /* Create and setting up frame */ 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_left = runRoot.getContentPane(); //runTreePanel = new QueryPreviousRunsPanel(this, null); //oAwtContainer_left.add(runTreePanel); // Select the first tab (index is zero-based) queryRunFolder.setSelection(0); final SashForm verticalForm = new SashForm(horizontalForm, SWT.VERTICAL); verticalForm.setOrientation(SWT.VERTICAL); verticalForm.setLayout(null); Composite rightComp = new Composite(verticalForm, SWT.BORDER | SWT.EMBEDDED | SWT.DragDetect); /* Create and setting up frame */ 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) { queryPanel = new QueryPanelInvestigator(this); } else { queryPanel = new QueryPanel(this); } oAwtContainer.add(queryPanel); queryPanel.setSplitBounds(oAwtContainer.getBounds()); if (mode_ == 0) { //bottomC = new ExplorerC(verticalForm, false); verticalForm.setWeights(new int[] { 40, 50 }); } verticalForm.addListener(SWT.Resize, new Listener() { public void handleEvent(Event event) { if (mode_ == 0) { int height = verticalForm.getBounds().height; //System.out.println("Height: "+height); if (height > 285) { try { verticalForm.setWeights(new int[] { 285, height - 285 }); } catch (Exception e) { return; } } } } }); horizontalForm.setWeights(new int[] { 20, 70 }); return parent; }
From source file:edu.harvard.i2b2.query.ui.QueryC.java
/** * @param args/*from w w w . j a v a2s . co m*/ */ protected Control createContents(Composite parent) { // log.info("Starting Query Mode"); GridLayout topGridLayout = new GridLayout(1, false); topGridLayout.numColumns = 1; topGridLayout.marginWidth = 2; topGridLayout.marginHeight = 2; setLayout(topGridLayout); Composite queryComposite = new Composite(this, 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); // the horizontal sash form SashForm horizontalForm = new SashForm(queryComposite, SWT.HORIZONTAL); horizontalForm.setOrientation(SWT.HORIZONTAL); horizontalForm.setLayout(new GridLayout()); // left sash form SashForm leftVerticalForm = new SashForm(horizontalForm, SWT.VERTICAL); leftVerticalForm.setOrientation(SWT.VERTICAL); leftVerticalForm.setLayout(new GridLayout()); if (bWantStatusLine) { slm.createControl(this, SWT.NULL); } slm.setMessage("i2b2 Explorer Version 1.6.0"); slm.update(true); // Create the tab folder final TabFolder oTabFolder = new TabFolder(leftVerticalForm, SWT.NONE); // Create each tab and set its text, tool tip text, // image, and control TabItem oTreeTab = new TabItem(oTabFolder, SWT.NONE); oTreeTab.setText("Concept trees"); oTreeTab.setToolTipText("Hierarchically organized patient characteristics"); oTreeTab.setControl(getQueryTabControl(oTabFolder)); // TabItem oFindTab = new TabItem(oTabFolder, SWT.NONE); // oFindTab.setText("Find"); // oFindTab.setToolTipText( // "Free-form find tool for patient characteristics"); // FindTool find = new FindTool(slm); // oFindTab.setControl(find.getFindTabControl(oTabFolder)); // Select the first tab (index is zero-based) oTabFolder.setSelection(0); // Create the tab folder final TabFolder queryRunFolder = new TabFolder(leftVerticalForm, SWT.NONE); TabItem previousRunTab = new TabItem(queryRunFolder, SWT.NONE); previousRunTab.setText("Patient Sets and Previous Queries"); previousRunTab.setToolTipText("Patient Sets & Previous Queries"); final Composite composite = new Composite(queryRunFolder, SWT.EMBEDDED); previousRunTab.setControl(composite); /* Create and setting up frame */ 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_left = runRoot.getContentPane(); // runTreePanel = new QueryPreviousRunsPanel(this, null); // oAwtContainer_left.add(runTreePanel); // Select the first tab (index is zero-based) queryRunFolder.setSelection(0); final SashForm verticalForm = new SashForm(horizontalForm, SWT.VERTICAL); verticalForm.setOrientation(SWT.VERTICAL); verticalForm.setLayout(null); Composite rightComp = new Composite(verticalForm, SWT.BORDER | SWT.EMBEDDED | SWT.DragDetect); /* Create and setting up frame */ 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(this); } oAwtContainer.add(queryToolPanel); queryToolPanel.setSplitBounds(oAwtContainer.getBounds()); if (mode_ == 0) { // bottomC = new ExplorerC(verticalForm, false); verticalForm.setWeights(new int[] { 40, 50 }); } verticalForm.addListener(SWT.Resize, new Listener() { public void handleEvent(Event event) { if (mode_ == 0) { int height = verticalForm.getBounds().height; // System.out.println("Height: "+height); if (height > 285) { try { verticalForm.setWeights(new int[] { 285, height - 285 }); } catch (Exception e) { return; } } } } }); horizontalForm.setWeights(new int[] { 20, 70 }); return parent; }
From source file:com.qspin.qtaste.ui.MainPanel.java
public void setQSpinTheme() { mTheme = new QSpinTheme(); MetalLookAndFeel.setCurrentTheme(mTheme); try {/*from ww w .ja v a 2 s . co m*/ UIManager.setLookAndFeel(new MetalLookAndFeel()); ((WrappedToolTipUI) WrappedToolTipUI.createUI(null)).setMaxWidth(200); UIManager.put("ToolTipUI", "com.qspin.qtaste.ui.tools.WrappedToolTipUI"); } catch (UnsupportedLookAndFeelException ex) { } }
From source file:edu.harvard.i2b2.previousquery.QueryC.java
/** * @param args/*from ww w . j a v a2 s . c o m*/ */ protected Control createContents(Composite parent) { //log.info("Starting Query Mode"); GridLayout topGridLayout = new GridLayout(1, false); topGridLayout.numColumns = 1; topGridLayout.marginWidth = 2; topGridLayout.marginHeight = 2; setLayout(topGridLayout); Composite queryComposite = new Composite(this, 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); // the horizontal sash form SashForm horizontalForm = new SashForm(queryComposite, SWT.HORIZONTAL); horizontalForm.setOrientation(SWT.HORIZONTAL); horizontalForm.setLayout(new GridLayout()); //left sash form SashForm leftVerticalForm = new SashForm(horizontalForm, SWT.VERTICAL); leftVerticalForm.setOrientation(SWT.VERTICAL); leftVerticalForm.setLayout(new GridLayout()); if (bWantStatusLine) { slm.createControl(this, SWT.NULL); } slm.setMessage("i2b2 Explorer Version 2.0"); slm.update(true); // Create the tab folder final TabFolder oTabFolder = new TabFolder(leftVerticalForm, SWT.NONE); // Create each tab and set its text, tool tip text, // image, and control TabItem oTreeTab = new TabItem(oTabFolder, SWT.NONE); oTreeTab.setText("Concept trees"); oTreeTab.setToolTipText("Hierarchically organized patient characteristics"); oTreeTab.setControl(getQueryTabControl(oTabFolder)); TabItem oFindTab = new TabItem(oTabFolder, SWT.NONE); oFindTab.setText("Find"); oFindTab.setToolTipText("Free-form find tool for patient characteristics"); //FindTool find = new FindTool(slm); //oFindTab.setControl(find.getFindTabControl(oTabFolder)); // Select the first tab (index is zero-based) oTabFolder.setSelection(0); // Create the tab folder final TabFolder queryRunFolder = new TabFolder(leftVerticalForm, SWT.NONE); TabItem previousRunTab = new TabItem(queryRunFolder, SWT.NONE); previousRunTab.setText("Patient Sets and Previous Queries"); previousRunTab.setToolTipText("Patient Sets & Previous Queries"); final Composite composite = new Composite(queryRunFolder, SWT.EMBEDDED); previousRunTab.setControl(composite); /* Create and setting up frame */ 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_left = runRoot.getContentPane(); runTreePanel = new QueryPreviousRunsPanel(this);//, null); oAwtContainer_left.add(runTreePanel); // Select the first tab (index is zero-based) queryRunFolder.setSelection(0); final SashForm verticalForm = new SashForm(horizontalForm, SWT.VERTICAL); verticalForm.setOrientation(SWT.VERTICAL); verticalForm.setLayout(null); Composite rightComp = new Composite(verticalForm, SWT.BORDER | SWT.EMBEDDED | SWT.DragDetect); /* Create and setting up frame */ 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) { //queryPanel = new QueryPanelInvestigator(this); } else { queryPanel = new QueryPanel(this); } oAwtContainer.add(queryPanel); queryPanel.setSplitBounds(oAwtContainer.getBounds()); if (mode_ == 0) { //bottomC = new ExplorerC(verticalForm, false); verticalForm.setWeights(new int[] { 40, 50 }); } verticalForm.addListener(SWT.Resize, new Listener() { public void handleEvent(Event event) { if (mode_ == 0) { int height = verticalForm.getBounds().height; //System.out.println("Height: "+height); if (height > 285) { try { verticalForm.setWeights(new int[] { 285, height - 285 }); } catch (Exception e) { return; } } } } }); horizontalForm.setWeights(new int[] { 20, 70 }); return parent; }
From source file:forms.frDados.java
/** * Instancia o form.//w w w.j a va2 s. c om */ public frDados() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); //SwingUtilities.updateComponentTreeUI(this); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { Logger.getLogger(frDados.class.getName()).log(Level.SEVERE, null, ex); } initComponents(); this.setLocationRelativeTo(null); inicializarTemas(); initSatGrafico(); initSatVelox(); initMapPanel(); init3DMapPanel(); carregarListaUsers(); initOsmPanel(); cmbPortas.setModel(new DefaultComboBoxModel(ComunicadorSerial.getPortasDisponiveis())); /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { setVisible(true); } }); }