Reflections on Tech. Life
This link:
Forums - What are some of the UIManager keys for changing the java look and feel? is also related to Java Swing Look and Feel issues. I'm sure it will be a useful resource in the future. In case this link goes dead though, I'll lift the code example supplied. Full credit for it goes to Alex Burton of
http://www.e-plus.com.au
public static void outputUIDefaults() {
// testing only
// Get the currently installed look and feel
UIDefaults uidefs = UIManager.getLookAndFeelDefaults();
// Retrieve the keys. Can't use an iterator since the map
// may be modified during the iteration. So retrieve all at once.
String[] keys = (String[] uidefs.keySet().toArray(new String[0];
for (int i = 0; i < keys.length; i++) {
Object v = uidefs.get(keys);
System.out.println(keys + " " + v.getClass() + ":" + v.toString());
if (v instanceof Integer) {
int intVal = uidefs.getInt(keys);
}
else if (v instanceof Boolean) {
boolean boolVal = uidefs.getBoolean(keys);
}
else if (v instanceof String) {
String strVal = uidefs.getString(keys);
}
else if (v instanceof Dimension) {
Dimension dimVal = uidefs.getDimension(keys);
}
else if (v instanceof Insets) {
Insets insetsVal = uidefs.getInsets(keys);
}
else if (v instanceof Color) {
Color colorVal = uidefs.getColor(keys);
}
else if (v instanceof Font) {
Font fontVal = uidefs.getFont(keys);
}
else if (v instanceof Border) {
Border borderVal = uidefs.getBorder(keys);
}
else if (v instanceof Icon) {
Icon iconVal = uidefs.getIcon(keys);
}
else if (v instanceof javax.swing.text.JTextComponent.KeyBinding[] {
javax.swing.text.JTextComponent.KeyBinding[] keyBindsVal = (
javax.swing.text.JTextComponent.KeyBinding[] uidefs.get(keys);
}
else if (v instanceof InputMap) {
InputMap imapVal = (InputMap) uidefs.get(keys);
}
else {
// Unknown type
}
}
}