当前位置: 首页>>代码示例>>Java>>正文


Java DefaultLookup.getInsets方法代码示例

本文整理汇总了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");
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:59,代码来源:DefaultTreeCellRenderer.java

示例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");
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:59,代码来源:DefaultTreeCellRenderer.java


注:本文中的sun.swing.DefaultLookup.getInsets方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。