Java examples for Swing:JButton
Prints all Default UI resource entries for a type of resource, such as a Button or a ToggleButton.
//package com.java2s; import javax.swing.UIManager; public class Main { public static void main(String[] argv) throws Exception { printDefaultUIResource();// w ww .ja va 2 s.co m } /** * Prints all DefaultUI resource entries for a type of resource, such as a * Button or a ToggleButton. * * @param type = Resource type. Not case sensitive. Package information is not required. */ public static void printDefaultUIResource(String type) { java.util.Enumeration keys = UIManager.getDefaults().keys(); if (type == null) { printDefaultUIResource(); return; } while (keys.hasMoreElements()) { Object key = keys.nextElement(); Object value = UIManager.get(key); String keyString = key.toString(); int index = keyString.indexOf('.'); int prevIndex = 0; while (index >= 0) { if (keyString.substring(prevIndex, index).equalsIgnoreCase( type)) { System.out.println(key + "=" + value); break; } prevIndex = index + 1; index = keyString.indexOf('.', index + 1); } } } /** * Prints all DefaultUI resource entries. * */ public static void printDefaultUIResource() { java.util.Enumeration keys = UIManager.getDefaults().keys(); while (keys.hasMoreElements()) { Object key = keys.nextElement(); Object value = UIManager.get(key); System.out.println(key + "=" + value); } } }