List of usage examples for javax.swing UIManager getLookAndFeelDefaults
public static UIDefaults getLookAndFeelDefaults()
From source file:Main.java
public static void main(String[] args) throws Exception { Set defaults = UIManager.getLookAndFeelDefaults().entrySet(); for (Iterator i = defaults.iterator(); i.hasNext();) { Map.Entry entry = (Map.Entry) i.next(); System.out.print(entry.getKey() + " = "); System.out.println(entry.getValue()); }/*from w w w . ja va 2 s . c om*/ }
From source file:Main.java
public static void main(String[] argv) { UIDefaults uidefs = UIManager.getLookAndFeelDefaults(); String[] keys = (String[]) uidefs.keySet().toArray(new String[0]); for (int i = 0; i < keys.length; i++) { Object v = uidefs.get(keys[i]); if (v instanceof Integer) { int intVal = uidefs.getInt(keys[i]); } else if (v instanceof Boolean) { boolean boolVal = uidefs.getBoolean(keys[i]); } else if (v instanceof String) { String strVal = uidefs.getString(keys[i]); } else if (v instanceof Dimension) { Dimension dimVal = uidefs.getDimension(keys[i]); } else if (v instanceof Insets) { Insets insetsVal = uidefs.getInsets(keys[i]); } else if (v instanceof Color) { Color colorVal = uidefs.getColor(keys[i]); } else if (v instanceof Font) { Font fontVal = uidefs.getFont(keys[i]); } else if (v instanceof Border) { Border borderVal = uidefs.getBorder(keys[i]); } else if (v instanceof Icon) { Icon iconVal = uidefs.getIcon(keys[i]); } else if (v instanceof javax.swing.text.JTextComponent.KeyBinding[]) { javax.swing.text.JTextComponent.KeyBinding[] keyBindsVal = (javax.swing.text.JTextComponent.KeyBinding[]) uidefs .get(keys[i]);//from www . ja va 2s . co m } else if (v instanceof InputMap) { InputMap imapVal = (InputMap) uidefs.get(keys[i]); } else { System.out.println("Unknown type"); } } }
From source file:Main.java
public static void main(String[] argv) { UIDefaults uidefs = UIManager.getLookAndFeelDefaults(); String[] keys = (String[]) uidefs.keySet().toArray(new String[0]); for (int i = 0; i < keys.length; i++) { Object v = uidefs.get(keys[i]); if (v instanceof Integer) { int intVal = uidefs.getInt(keys[i]); } else if (v instanceof Boolean) { boolean boolVal = uidefs.getBoolean(keys[i]); } else if (v instanceof String) { String strVal = uidefs.getString(keys[i]); } else if (v instanceof Dimension) { Dimension dimVal = uidefs.getDimension(keys[i]); } else if (v instanceof Insets) { Insets insetsVal = uidefs.getInsets(keys[i]); } else if (v instanceof Color) { Color colorVal = uidefs.getColor(keys[i]); } else if (v instanceof Font) { Font fontVal = uidefs.getFont(keys[i]); } else if (v instanceof Border) { Border borderVal = uidefs.getBorder(keys[i]); } else if (v instanceof Icon) { Icon iconVal = uidefs.getIcon(keys[i]); } else if (v instanceof javax.swing.text.JTextComponent.KeyBinding[]) { JTextComponent.KeyBinding[] keyBindsVal = (JTextComponent.KeyBinding[]) uidefs.get(keys[i]); } else if (v instanceof InputMap) { InputMap imapVal = (InputMap) uidefs.get(keys[i]); } else {/*w w w. j av a 2 s .c o m*/ System.out.println("Unknown type"); } } }
From source file:com.adobe.aem.demo.gui.AemDemo.java
public static void main(String[] args) { String demoMachineRootFolder = null; // Command line options for this tool Options options = new Options(); options.addOption("f", true, "Path to Demo Machine root folder"); CommandLineParser parser = new BasicParser(); try {/*w w w . j a v a2s.com*/ CommandLine cmd = parser.parse(options, args); if (cmd.hasOption("f")) { demoMachineRootFolder = cmd.getOptionValue("f"); } } catch (ParseException ex) { logger.error(ex.getMessage()); } // Let's check if we have a valid build.xml file to work with... String buildFilePath = (demoMachineRootFolder != null ? demoMachineRootFolder : System.getProperty("user.dir")) + File.separator + "build.xml"; logger.debug("Trying to load build file from " + buildFilePath); buildFile = new File(buildFilePath); if (buildFile.exists() && !buildFile.isDirectory()) { // Launching the main window EventQueue.invokeLater(new Runnable() { public void run() { try { UIManager.getLookAndFeelDefaults().put("defaultFont", new Font("Arial", Font.BOLD, 14)); AemDemo window = new AemDemo(); window.frameMain.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } else { logger.error("No valid build.xml file to work with"); System.exit(-1); } }
From source file:com.ibm.soatf.SOATestingFramework.java
/** * SOA Testing Framework main static method. * * @param args Main input parameters./*from w w w .ja va 2 s. c o m*/ */ public static void main(String[] args) { Options options = new Options(); options.addOption(new Option("gui", "Display a GUI")); options.addOption(OptionBuilder.withArgName("environment").hasArg() .withDescription("Environment to run the tests on").create("env")); // has a value options.addOption(OptionBuilder.withArgName("project").hasArg() .withDescription("Project to run the tests on").create("p")); // has a value options.addOption(OptionBuilder.withArgName("interface").hasArg() .withDescription("Interface to run the tests on").create("i")); // has a value CommandLineParser parser = new BasicParser(); try { CommandLine cmd = parser.parse(options, args); validate(cmd); if (cmd.hasOption("gui")) { /* 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 { if (false) { //disabled the OS Look'n'Feel UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } else { for (UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } UIManager.getLookAndFeelDefaults().put("nimbusOrange", (new Color(0, 128, 255))); } } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) { logger.error("Cannot set look and feel", ex); } //</editor-fold> final SOATestingFrameworkGUI soatfgui = new SOATestingFrameworkGUI(); java.awt.EventQueue.invokeLater(new Runnable() { @Override public void run() { soatfgui.setVisible(true); } }); } else { //<editor-fold defaultstate="collapsed" desc="Command line mode"> try { // Initialization of configuration manager. ConfigurationManager.getInstance().init(); String env = cmd.getOptionValue("env", null); String ifaceName; boolean inboundOnly = false; if (cmd.hasOption("p")) { String projectName = cmd.getOptionValue("p"); MasterConfiguration masterConfig = ConfigurationManager.getInstance().getMasterConfig(); List<SOATestingFrameworkMasterConfiguration.Interfaces.Interface> interfaces = masterConfig .getInterfaces(); all: for (Interface iface : interfaces) { List<Project> projects = iface.getProjects().getProject(); for (Project project : projects) { if (project.getName().equals(projectName)) { inboundOnly = "INBOUND".equalsIgnoreCase(project.getDirection()); ifaceName = iface.getName(); break all; } } } throw new FrameworkExecutionException( "No such project found in master configuration: " + projectName); } else { ifaceName = cmd.getOptionValue("i"); inboundOnly = false; } DirectoryStructureManager.checkFrameworkDirectoryStructure(ifaceName); FlowExecutor flowExecutor = new FlowExecutor(inboundOnly, env, ifaceName); flowExecutor.execute(); } catch (FrameworkConfigurationException ex) { logger.fatal("Configuration corrupted. See the exception stack trace for details.", ex); } catch (FrameworkException ex) { logger.fatal(ex); } //</editor-fold> } } catch (ParseException ex) { logger.fatal("Could not parse the command line arguments. Reason: " + ex); printUsage(); } catch (Throwable ex) { logger.fatal("Unexpected error occured: ", ex); printUsage(); System.exit(-1); } }
From source file:com.adobe.aem.demomachine.gui.AemDemo.java
public static void main(String[] args) { String demoMachineRootFolder = null; // Command line options for this tool Options options = new Options(); options.addOption("f", true, "Path to Demo Machine root folder"); CommandLineParser parser = new BasicParser(); try {/* w w w . ja v a 2s . c om*/ CommandLine cmd = parser.parse(options, args); if (cmd.hasOption("f")) { demoMachineRootFolder = cmd.getOptionValue("f"); } } catch (ParseException ex) { logger.error(ex.getMessage()); } // Let's grab the version number for the core Maven file String mavenFilePath = (demoMachineRootFolder != null ? demoMachineRootFolder : System.getProperty("user.dir")) + File.separator + "java" + File.separator + "core" + File.separator + "pom.xml"; File mavenFile = new File(mavenFilePath); if (mavenFile.exists() && !mavenFile.isDirectory()) { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document document; document = builder.parse(mavenFile); NodeList list = document.getElementsByTagName("version"); if (list != null && list.getLength() > 0) { aemDemoMachineVersion = list.item(0).getFirstChild().getNodeValue(); } } catch (Exception e) { logger.error("Can't parse Maven pom.xml file"); } } // Let's check if we have a valid build.xml file to work with... String buildFilePath = (demoMachineRootFolder != null ? demoMachineRootFolder : System.getProperty("user.dir")) + File.separator + "build.xml"; logger.debug("Trying to load build file from " + buildFilePath); buildFile = new File(buildFilePath); if (buildFile.exists() && !buildFile.isDirectory()) { // Launching the main window EventQueue.invokeLater(new Runnable() { public void run() { try { UIManager.getLookAndFeelDefaults().put("defaultFont", new Font("Arial", Font.BOLD, 14)); AemDemo window = new AemDemo(); window.frameMain.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } else { logger.error("No valid build.xml file to work with"); System.exit(-1); } }
From source file:Main.java
/** * Returns a string with all fonts used by Swing's UIManager. *///from www . jav a 2s .c o m public static String getUIFonts() { final StringBuffer fonts = new StringBuffer(128); fonts.append("Default font: "); fonts.append(getUIFont().toString()); final Enumeration<Object> keys = UIManager.getLookAndFeelDefaults().keys(); String lf = System.getProperty("line.separator"); while (keys.hasMoreElements()) { final Object key = keys.nextElement(); final Object value = UIManager.get(key); if (value instanceof Font) { final Font ifont = (Font) value; fonts.append(lf + key.toString() + " " + ifont.getName() + " " + ifont.getStyle() + " " + ifont.getSize()); } } return fonts.toString(); }
From source file:Main.java
/** * Sets all used fonts for displaying to the specified font df * <br>Use with care! // ww w.j av a2s .co m */ public static void setUIFont(final Font df) { setUIFontSize(df.getSize()); final Enumeration<Object> keys = UIManager.getLookAndFeelDefaults().keys(); while (keys.hasMoreElements()) { final Object key = keys.nextElement(); final Object value = UIManager.get(key); if (value instanceof Font) { final Font ifont = (Font) value; final Font ofont = new FontUIResource(df.getName(), ifont.getStyle(), df.getSize()); UIManager.put(key, ofont); } } }
From source file:Main.java
public static void setTheme() { final Color color = new Color(85, 142, 119); final Color colorBackground = new Color(247, 247, 247); Image error_dialog_icon = new ImageIcon("/images/error_dialog.png").getImage(); UIManager.getLookAndFeelDefaults().put("nimbusOrange", color); UIManager.getLookAndFeelDefaults().put("control", colorBackground); UIManager.getLookAndFeelDefaults().put("OptionPane.errorIcon", error_dialog_icon); UIManager.getLookAndFeelDefaults().put("OptionPane.background", colorBackground); UIManager.getLookAndFeelDefaults().put("Panel.background", new Color(245, 245, 245)); UIManager.put("Table.background", new Color(250, 250, 250)); // UIManager.put("Table.alternateRowColor", new Color(159,203,64)); }
From source file:Main.java
/** * Convenience method for retrieving a subset of the UIDefaults pertaining * to a particular class.//w ww . j ava 2s . c o m * * @param className fully qualified name of the class of interest * @return the UIDefaults of the class named */ public static UIDefaults getUIDefaultsOfClass(String className) { UIDefaults retVal = new UIDefaults(); UIDefaults defaults = UIManager.getLookAndFeelDefaults(); List<?> listKeys = Collections.list(defaults.keys()); for (Object key : listKeys) { if (key instanceof String && ((String) key).startsWith(className)) { String stringKey = (String) key; String property = stringKey; if (stringKey.contains(".")) { property = stringKey.substring(stringKey.indexOf(".") + 1); } retVal.put(property, defaults.get(key)); } } return retVal; }