下面列出了javax.swing.UIDefaults#get ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
protected void installKeyboardActions() {
super.installKeyboardActions();
JTextComponent comp = getComponent();
UIDefaults uidefaults = XToolkit.getUIDefaults();
String prefix = getPropertyPrefix();
InputMap map = (InputMap)uidefaults.get(prefix + ".focusInputMap");
if (map != null) {
SwingUtilities.replaceUIInputMap(comp, JComponent.WHEN_FOCUSED,
map);
}
}
@Override
protected void installKeyboardActions() {
super.installKeyboardActions();
JTextComponent comp = getComponent();
UIDefaults uidefaults = XToolkit.getUIDefaults();
String prefix = getPropertyPrefix();
InputMap map = (InputMap)uidefaults.get(prefix + ".focusInputMap");
if (map != null) {
SwingUtilities.replaceUIInputMap(comp, JComponent.WHEN_FOCUSED,
map);
}
}
@Override
protected void installKeyboardActions() {
super.installKeyboardActions();
JTextComponent comp = getComponent();
UIDefaults uidefaults = XToolkit.getUIDefaults();
String prefix = getPropertyPrefix();
InputMap map = (InputMap)uidefaults.get(prefix + ".focusInputMap");
if (map != null) {
SwingUtilities.replaceUIInputMap(comp, JComponent.WHEN_FOCUSED,
map);
}
}
@Override
protected void installKeyboardActions() {
super.installKeyboardActions();
JTextComponent comp = getComponent();
UIDefaults uidefaults = XToolkit.getUIDefaults();
String prefix = getPropertyPrefix();
InputMap map = (InputMap)uidefaults.get(prefix + ".focusInputMap");
if (map != null) {
SwingUtilities.replaceUIInputMap(comp, JComponent.WHEN_FOCUSED,
map);
}
}
@Override
protected void installKeyboardActions() {
super.installKeyboardActions();
JTextComponent comp = getComponent();
UIDefaults uidefaults = XToolkit.getUIDefaults();
String prefix = getPropertyPrefix();
InputMap map = (InputMap)uidefaults.get(prefix + ".focusInputMap");
if (map != null) {
SwingUtilities.replaceUIInputMap(comp, JComponent.WHEN_FOCUSED,
map);
}
}
@Override
protected void installKeyboardActions() {
super.installKeyboardActions();
JTextComponent comp = getComponent();
UIDefaults uidefaults = XToolkit.getUIDefaults();
String prefix = getPropertyPrefix();
InputMap map = (InputMap)uidefaults.get(prefix + ".focusInputMap");
if (map != null) {
SwingUtilities.replaceUIInputMap(comp, JComponent.WHEN_FOCUSED,
map);
}
}
@Override
protected void installKeyboardActions() {
super.installKeyboardActions();
JTextComponent comp = getComponent();
UIDefaults uidefaults = XToolkit.getUIDefaults();
String prefix = getPropertyPrefix();
InputMap map = (InputMap)uidefaults.get(prefix + ".focusInputMap");
if (map != null) {
SwingUtilities.replaceUIInputMap(comp, JComponent.WHEN_FOCUSED,
map);
}
}
@Override
protected void installKeyboardActions() {
super.installKeyboardActions();
JTextComponent comp = getComponent();
UIDefaults uidefaults = XToolkit.getUIDefaults();
String prefix = getPropertyPrefix();
InputMap map = (InputMap)uidefaults.get(prefix + ".focusInputMap");
if (map != null) {
SwingUtilities.replaceUIInputMap(comp, JComponent.WHEN_FOCUSED,
map);
}
}
@Override
protected void installKeyboardActions() {
super.installKeyboardActions();
JTextComponent comp = getComponent();
UIDefaults uidefaults = XToolkit.getUIDefaults();
String prefix = getPropertyPrefix();
InputMap map = (InputMap)uidefaults.get(prefix + ".focusInputMap");
if (map != null) {
SwingUtilities.replaceUIInputMap(comp, JComponent.WHEN_FOCUSED,
map);
}
}
@Override
protected void installKeyboardActions() {
super.installKeyboardActions();
JTextComponent comp = getComponent();
UIDefaults uidefaults = XToolkit.getUIDefaults();
String prefix = getPropertyPrefix();
InputMap map = (InputMap)uidefaults.get(prefix + ".focusInputMap");
if (map != null) {
SwingUtilities.replaceUIInputMap(comp, JComponent.WHEN_FOCUSED,
map);
}
}
@Override
protected void installKeyboardActions() {
super.installKeyboardActions();
JTextComponent comp = getComponent();
UIDefaults uidefaults = XToolkit.getUIDefaults();
String prefix = getPropertyPrefix();
InputMap map = (InputMap)uidefaults.get(prefix + ".focusInputMap");
if (map != null) {
SwingUtilities.replaceUIInputMap(comp, JComponent.WHEN_FOCUSED,
map);
}
}
@Override
protected void installKeyboardActions() {
super.installKeyboardActions();
JTextComponent comp = getComponent();
UIDefaults uidefaults = XToolkit.getUIDefaults();
String prefix = getPropertyPrefix();
InputMap map = (InputMap)uidefaults.get(prefix + ".focusInputMap");
if (map != null) {
SwingUtilities.replaceUIInputMap(comp, JComponent.WHEN_FOCUSED,
map);
}
}
@Override
protected void installKeyboardActions() {
super.installKeyboardActions();
JTextComponent comp = getComponent();
UIDefaults uidefaults = XToolkit.getUIDefaults();
String prefix = getPropertyPrefix();
InputMap map = (InputMap)uidefaults.get(prefix + ".focusInputMap");
if (map != null) {
SwingUtilities.replaceUIInputMap(comp, JComponent.WHEN_FOCUSED,
map);
}
}
@Override
protected void installKeyboardActions() {
super.installKeyboardActions();
JTextComponent comp = getComponent();
UIDefaults uidefaults = XToolkit.getUIDefaults();
String prefix = getPropertyPrefix();
InputMap map = (InputMap)uidefaults.get(prefix + ".focusInputMap");
if (map != null) {
SwingUtilities.replaceUIInputMap(comp, JComponent.WHEN_FOCUSED,
map);
}
}
@Override
public Object createValue(UIDefaults table) {
try {
Class c;
Object cl;
// See if we should use a separate ClassLoader
if (table == null || !((cl = table.get("ClassLoader"))
instanceof ClassLoader)) {
cl = Thread.currentThread().
getContextClassLoader();
if (cl == null) {
// Fallback to the system class loader.
cl = ClassLoader.getSystemClassLoader();
}
}
c = Class.forName(className, true, (ClassLoader)cl);
Constructor constructor = c.getConstructor(
AbstractRegionPainter.PaintContext.class, int.class);
if (constructor == null) {
throw new NullPointerException(
"Failed to find the constructor for the class: " +
className);
}
return constructor.newInstance(ctx, which);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
@Override
public Object createValue(UIDefaults table) {
try {
Class c;
Object cl;
// See if we should use a separate ClassLoader
if (table == null || !((cl = table.get("ClassLoader"))
instanceof ClassLoader)) {
cl = Thread.currentThread().
getContextClassLoader();
if (cl == null) {
// Fallback to the system class loader.
cl = ClassLoader.getSystemClassLoader();
}
}
c = Class.forName(className, true, (ClassLoader)cl);
Constructor constructor = c.getConstructor(
AbstractRegionPainter.PaintContext.class, int.class);
if (constructor == null) {
throw new NullPointerException(
"Failed to find the constructor for the class: " +
className);
}
return constructor.newInstance(ctx, which);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
@Override
public Object createValue(UIDefaults table) {
try {
Class c;
Object cl;
// See if we should use a separate ClassLoader
if (table == null || !((cl = table.get("ClassLoader"))
instanceof ClassLoader)) {
cl = Thread.currentThread().
getContextClassLoader();
if (cl == null) {
// Fallback to the system class loader.
cl = ClassLoader.getSystemClassLoader();
}
}
c = Class.forName(className, true, (ClassLoader)cl);
Constructor constructor = c.getConstructor(
AbstractRegionPainter.PaintContext.class, int.class);
if (constructor == null) {
throw new NullPointerException(
"Failed to find the constructor for the class: " +
className);
}
return constructor.newInstance(ctx, which);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
@Override
public UIDefaults getDefaults() {
final UIDefaults del = super.getDefaults();
return new UIDefaults() {
@Override
public Object get(Object key) {
if( "SeparatorUI".equals( key ) )
assertAWT();
return del.get(key);
}
};
}
/**
* @see javax.swing.UIDefaults$LazyValue#createValue(javax.swing.UIDefaults)
*/
@SuppressWarnings("unchecked")
public Object createValue(UIDefaults table) {
Constructor constructor = null;
Object cl = null;
try {
Class c;
// See if we should use a separate ClassLoader
// GM: use ClassLoader from this class, if no separate ClassLoader
cl = table.get("ClassLoader");
if (cl == null) {
cl = getClass().getClassLoader();
}
// GM: doesn't work with WebStart and OSGi
// if (table == null || !(cl instanceof ClassLoader)) {
// cl = Thread.currentThread().getContextClassLoader();
//
// if (cl == null) {
//
// // Fallback to the system class loader.
// cl = ClassLoader.getSystemClassLoader();
// }
// }
c = Class.forName(className, true, (ClassLoader) cl);
// Find inner class for state.
Class stateClass = Class.forName(className + "$Which", false, (ClassLoader) cl);
if (stateClass == null) {
throw new NullPointerException("Failed to find the constructor for the class: " + className + ".Which");
}
constructor = c.getConstructor(stateClass);
if (constructor == null) {
throw new NullPointerException("Failed to find the constructor for the class: " + className);
}
return constructor.newInstance(which);
} catch (Exception e) {
System.err.println( "createValue: " + which.getClass() + ", " + (constructor != null ? constructor : "") );
System.err.println( "class loaders: " + which.getClass().getClassLoader() + ", " + cl + ", UIDefaults = " + table );
e.printStackTrace();
return null;
}
}
private static Object getValue(UIDefaults defaults) {
return defaults.get("MetalTitlePane.restore.titleAndMnemonic");
}