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:net.sourceforge.happybank.main.BankMain.java
/** * launch the application, parsing any command lines *//*from w ww .ja v a 2 s .com*/ public static void main(String[] args) { // force System look and feel try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception exc) { System.err.println("Error loading look and feel: " + exc); } // fire up the program BankMain admin = new BankMain(); admin.frame.setVisible(true); }
From source file:LookAndFeelPrefs.java
/** * Get the desired look and feel from a per-user preference. If the * preferences doesn't exist or is unavailable, use the default look and feel. * The preference is shared by all classes in the same package as prefsClass. *///w ww. j a va2s .c o m public static void setPreferredLookAndFeel(Class prefsClass) { Preferences prefs = Preferences.userNodeForPackage(prefsClass); String defaultLAF = UIManager.getSystemLookAndFeelClassName(); String laf = prefs.get(PREF_NAME, defaultLAF); try { UIManager.setLookAndFeel(laf); } catch (Exception e) { // ClassNotFound or InstantiationException // An exception here is probably caused by a bogus preference. // Ignore it silently; the user will make do with the default LAF. } }
From source file:br.com.etec.Main.java
private static void installSmartLookAndFeel() throws UnsupportedLookAndFeelException { SmartLookAndFeel.setTheme(getLaFProperties()); UIManager.setLookAndFeel(new SmartLookAndFeel()); }
From source file:Main.java
/** * Workaround for Bug#5063999.//from ww w. java 2 s . com */ public static void installDefaults() { String defaultlaf = System.getProperty("swing.defaultlaf"); if (defaultlaf == null || defaultlaf.length() == 0) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | UnsupportedLookAndFeelException | IllegalAccessException | InstantiationException ex) { // NO-OP } } JFrame.setDefaultLookAndFeelDecorated(true); JDialog.setDefaultLookAndFeelDecorated(true); UIManager.put(FORMATTED_TEXTFIELD_FONT_KEY, UIManager.get(TEXTFIELD_FONT_KEY)); UIManager.put(FORMATTED_TEXTFIELD_INACTIVE_BACKGROUND_KEY, UIManager.get(TEXTFIELD_INACTIVE_BACKGROUND_KEY)); UIManager.put(PASSWORDFIELD_FONT_KEY, UIManager.get(TEXTFIELD_FONT_KEY)); // try { // UIManager.put(LafWidget.TABBED_PANE_PREVIEW_PAINTER, // new DefaultTabPreviewPainter() { // // /** // * {@inheritDoc} // */ // @Override // public TabOverviewKind getOverviewKind(JTabbedPane tabPane) { // return TabOverviewKind.ROUND_CAROUSEL; // // return TabOverviewKind.MENU_CAROUSEL; // } // }); // UIManager.put(LafWidget.COMPONENT_PREVIEW_PAINTER, // new DefaultPreviewPainter()); // UIManager.put(LafWidget.TEXT_EDIT_CONTEXT_MENU, Boolean.TRUE); // // UIManager.put(LafWidget.COMBO_BOX_NO_AUTOCOMPLETION, Boolean.TRUE); // } catch (Throwable ignored) { // // substance may not be available. // } }
From source file:mergedoc.Application.java
/** * ? Look & Feel ???/* w ww . ja v a2 s . c o m*/ * @throws ClassNotFoundException LookAndFeel ???????? * @throws InstantiationException ???????????? * @throws IllegalAccessException ???????????? * @throws UnsupportedLookAndFeelException lnf.isSupportedLookAndFeel() ? false ?? */ private static void initSystemLookAndFeel() throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); Toolkit.getDefaultToolkit().setDynamicLayout(true); // Windows ??? String osName = System.getProperty("os.name", ""); if (osName.indexOf("Windows") != -1) { Object propoFont = new FontUIResource("MS UI Gothic", Font.PLAIN, 12); Object fixedFont = new FontUIResource("MS Gothic", Font.PLAIN, 12); // ?????????? // ????? instanceof FontUIResource ? // ???UIDefaults ? Lazy Value ?????? for (Object keyObj : UIManager.getLookAndFeelDefaults().keySet()) { String key = keyObj.toString(); if (key.endsWith("font") || key.endsWith("Font")) { UIManager.put(key, propoFont); } } // ????? UIManager.put("OptionPane.messageFont", fixedFont); UIManager.put("TextPane.font", fixedFont); UIManager.put("TextArea.font", fixedFont); } }
From source file:com.akman.excel.view.frmSelectImage.java
/** * @param args the command line arguments *//*ww w . j a v a2 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 (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { /*if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; }*/ UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(frmSelectImage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(frmSelectImage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(frmSelectImage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(frmSelectImage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new frmSelectImage().setVisible(true); } }); }
From source file:org.jas.Launcher.java
public static void main(String[] args) { try {// w ww.j a v a2s. c o m UIManager.setLookAndFeel(HIPECOTECH_LNF); } catch (ClassNotFoundException e) { log.error(e, e); } catch (InstantiationException e) { log.error(e, e); } catch (IllegalAccessException e) { log.error(e, e); } catch (UnsupportedLookAndFeelException e) { log.error(e, e); } new Launcher(ApplicationContextSingleton.getApplicationContext()); }
From source file:com.shadwelldacunha.byteswipe.core.Utilities.java
public static void setLookAndFeel() { //TODO: Handle exceptions gracefully try {//w w w . j a v a 2 s.c o 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(); } }
From source file:edu.ku.brc.specify.conversion.SpecifyDBConverter.java
/** * @param args//from ww w . ja v a 2 s.co m * @throws Exception */ public static void main(String args[]) throws Exception { /*try { List<String> list = FileUtils.readLines(new File("/Users/rods/drop.sql")); Vector<String> list2 = new Vector<String>(); for (String line : list) { list2.add(line+";"); } FileUtils.writeLines(new File("/Users/rods/drop2.sql"), list2); return; } catch (Exception ex) { ex.printStackTrace(); }*/ // Set App Name, MUST be done very first thing! UIRegistry.setAppName("Specify"); //$NON-NLS-1$ log.debug("********* Current [" + (new File(".").getAbsolutePath()) + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ UIRegistry.setEmbeddedDBPath(UIRegistry.getDefaultEmbeddedDBPath()); // on the local machine AppBase.processArgs(args); final SpecifyDBConverter converter = new SpecifyDBConverter(); Logger logger = LogManager.getLogger("edu.ku.brc"); if (logger != null) { logger.setLevel(Level.ALL); System.out.println("Setting " + logger.getName() + " to " + logger.getLevel()); } logger = LogManager.getLogger(edu.ku.brc.dbsupport.HibernateUtil.class); if (logger != null) { logger.setLevel(Level.INFO); System.out.println("Setting " + logger.getName() + " to " + logger.getLevel()); } // Create Specify Application SwingUtilities.invokeLater(new Runnable() { public void run() { try { if (!System.getProperty("os.name").equals("Mac OS X")) { UIManager.setLookAndFeel(new Plastic3DLookAndFeel()); PlasticLookAndFeel.setPlasticTheme(new DesertBlue()); } } catch (Exception e) { log.error("Can't change L&F: ", e); } Pair<String, String> namePair = null; try { if (converter.selectedDBsToConvert(false)) { namePair = converter.chooseTable("Select a DB to Convert", "Specify 5 Databases", true); } } catch (SQLException ex) { ex.printStackTrace(); JOptionPane.showConfirmDialog(null, "The Converter was unable to login.", "Error", JOptionPane.CLOSED_OPTION); } if (namePair != null) { frame = new ProgressFrame("Converting"); converter.processDB(); } else { JOptionPane.showConfirmDialog(null, "The Converter was unable to login.", "Error", JOptionPane.CLOSED_OPTION); System.exit(0); } } }); }
From source file:ja.lingo.application.util.plaf.JaLingoLookAndFeel.java
public static void install(int fontSize, String fontFace) { // children dynamic re-layout on resize Toolkit.getDefaultToolkit().setDynamicLayout(true); // kunstoff//from w w w . j av a 2 s.c o m JaLingoLookAndFeel laf = new JaLingoLookAndFeel(); setCurrentTheme(new RainyTheme(fontSize, fontFace)); setCurrentGradientTheme(new RainyGradientTheme()); //LookAndFeel laf = new WindowsLookAndFeel(); // children LF //Plastic3DLookAndFeel laf = new Plastic3DLookAndFeel(); //Plastic3DLookAndFeel.setMyCurrentTheme( new ExperienceBlue() ); try { //UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() ); UIManager.setLookAndFeel(laf); //Wrapper.wrap(); } catch (Exception e) { LOG.warn("Could not initialize LF", e); } }