本文整理汇总了Java中sun.swing.DefaultLookup.getInsets方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultLookup.getInsets方法的具体用法?Java DefaultLookup.getInsets怎么用?Java DefaultLookup.getInsets使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sun.swing.DefaultLookup
的用法示例。
在下文中一共展示了DefaultLookup.getInsets方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateUI
import sun.swing.DefaultLookup; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*
* @since 1.7
*/
public void updateUI() {
super.updateUI();
// To avoid invoking new methods from the constructor, the
// inited field is first checked. If inited is false, the constructor
// has not run and there is no point in checking the value. As
// all look and feels have a non-null value for these properties,
// a null value means the developer has specifically set it to
// null. As such, if the value is null, this does not reset the
// value.
if (!inited || (getLeafIcon() instanceof UIResource)) {
setLeafIcon(DefaultLookup.getIcon(this, ui, "Tree.leafIcon"));
}
if (!inited || (getClosedIcon() instanceof UIResource)) {
setClosedIcon(DefaultLookup.getIcon(this, ui, "Tree.closedIcon"));
}
if (!inited || (getOpenIcon() instanceof UIManager)) {
setOpenIcon(DefaultLookup.getIcon(this, ui, "Tree.openIcon"));
}
if (!inited || (getTextSelectionColor() instanceof UIResource)) {
setTextSelectionColor(
DefaultLookup.getColor(this, ui, "Tree.selectionForeground"));
}
if (!inited || (getTextNonSelectionColor() instanceof UIResource)) {
setTextNonSelectionColor(
DefaultLookup.getColor(this, ui, "Tree.textForeground"));
}
if (!inited || (getBackgroundSelectionColor() instanceof UIResource)) {
setBackgroundSelectionColor(
DefaultLookup.getColor(this, ui, "Tree.selectionBackground"));
}
if (!inited ||
(getBackgroundNonSelectionColor() instanceof UIResource)) {
setBackgroundNonSelectionColor(
DefaultLookup.getColor(this, ui, "Tree.textBackground"));
}
if (!inited || (getBorderSelectionColor() instanceof UIResource)) {
setBorderSelectionColor(
DefaultLookup.getColor(this, ui, "Tree.selectionBorderColor"));
}
drawsFocusBorderAroundIcon = DefaultLookup.getBoolean(
this, ui, "Tree.drawsFocusBorderAroundIcon", false);
drawDashedFocusIndicator = DefaultLookup.getBoolean(
this, ui, "Tree.drawDashedFocusIndicator", false);
fillBackground = DefaultLookup.getBoolean(this, ui, "Tree.rendererFillBackground", true);
Insets margins = DefaultLookup.getInsets(this, ui, "Tree.rendererMargins");
if (margins != null) {
setBorder(new EmptyBorder(margins.top, margins.left,
margins.bottom, margins.right));
}
setName("Tree.cellRenderer");
}
示例2: updateUI
import sun.swing.DefaultLookup; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*
* @since 1.7
*/
public void updateUI() {
super.updateUI();
// To avoid invoking new methods from the constructor, the
// inited field is first checked. If inited is false, the constructor
// has not run and there is no point in checking the value. As
// all look and feels have a non-null value for these properties,
// a null value means the developer has specifically set it to
// null. As such, if the value is null, this does not reset the
// value.
if (!inited || (getLeafIcon() instanceof UIResource)) {
setLeafIcon(DefaultLookup.getIcon(this, ui, "Tree.leafIcon"));
}
if (!inited || (getClosedIcon() instanceof UIResource)) {
setClosedIcon(DefaultLookup.getIcon(this, ui, "Tree.closedIcon"));
}
if (!inited || (getOpenIcon() instanceof UIResource)) {
setOpenIcon(DefaultLookup.getIcon(this, ui, "Tree.openIcon"));
}
if (!inited || (getTextSelectionColor() instanceof UIResource)) {
setTextSelectionColor(
DefaultLookup.getColor(this, ui, "Tree.selectionForeground"));
}
if (!inited || (getTextNonSelectionColor() instanceof UIResource)) {
setTextNonSelectionColor(
DefaultLookup.getColor(this, ui, "Tree.textForeground"));
}
if (!inited || (getBackgroundSelectionColor() instanceof UIResource)) {
setBackgroundSelectionColor(
DefaultLookup.getColor(this, ui, "Tree.selectionBackground"));
}
if (!inited ||
(getBackgroundNonSelectionColor() instanceof UIResource)) {
setBackgroundNonSelectionColor(
DefaultLookup.getColor(this, ui, "Tree.textBackground"));
}
if (!inited || (getBorderSelectionColor() instanceof UIResource)) {
setBorderSelectionColor(
DefaultLookup.getColor(this, ui, "Tree.selectionBorderColor"));
}
drawsFocusBorderAroundIcon = DefaultLookup.getBoolean(
this, ui, "Tree.drawsFocusBorderAroundIcon", false);
drawDashedFocusIndicator = DefaultLookup.getBoolean(
this, ui, "Tree.drawDashedFocusIndicator", false);
fillBackground = DefaultLookup.getBoolean(this, ui, "Tree.rendererFillBackground", true);
Insets margins = DefaultLookup.getInsets(this, ui, "Tree.rendererMargins");
if (margins != null) {
setBorder(new EmptyBorder(margins.top, margins.left,
margins.bottom, margins.right));
}
setName("Tree.cellRenderer");
}