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


Java DefaultLookup.getBorder方法代码示例

本文整理汇总了Java中sun.swing.DefaultLookup.getBorder方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultLookup.getBorder方法的具体用法?Java DefaultLookup.getBorder怎么用?Java DefaultLookup.getBorder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sun.swing.DefaultLookup的用法示例。


在下文中一共展示了DefaultLookup.getBorder方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getNoFocusBorder

import sun.swing.DefaultLookup; //导入方法依赖的package包/类
private Border getNoFocusBorder() {
    Border border = DefaultLookup.getBorder(this, ui, "Table.cellNoFocusBorder");
    if (System.getSecurityManager() != null) {
        if (border != null) return border;
        return SAFE_NO_FOCUS_BORDER;
    } else if (border != null) {
        if (noFocusBorder == null || noFocusBorder == DEFAULT_NO_FOCUS_BORDER) {
            return border;
        }
    }
    return noFocusBorder;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:DefaultTableCellRenderer.java

示例2: getNoFocusBorder

import sun.swing.DefaultLookup; //导入方法依赖的package包/类
private Border getNoFocusBorder() {
    Border border = DefaultLookup.getBorder(this, ui, "List.cellNoFocusBorder");
    if (System.getSecurityManager() != null) {
        if (border != null) return border;
        return SAFE_NO_FOCUS_BORDER;
    } else {
        if (border != null &&
                (noFocusBorder == null ||
                noFocusBorder == DEFAULT_NO_FOCUS_BORDER)) {
            return border;
        }
        return noFocusBorder;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:DefaultListCellRenderer.java

示例3: getTableCellRendererComponent

import sun.swing.DefaultLookup; //导入方法依赖的package包/类
public Component getTableCellRendererComponent(JTable table, Object value,
        boolean isSelected, boolean hasFocus, int row, int column) {
    Icon sortIcon = null;

    boolean isPaintingForPrint = false;

    if (table != null) {
        JTableHeader header = table.getTableHeader();
        if (header != null) {
            Color fgColor = null;
            Color bgColor = null;
            if (hasFocus) {
                fgColor = DefaultLookup.getColor(this, ui, "TableHeader.focusCellForeground");
                bgColor = DefaultLookup.getColor(this, ui, "TableHeader.focusCellBackground");
            }
            if (fgColor == null) {
                fgColor = header.getForeground();
            }
            if (bgColor == null) {
                bgColor = header.getBackground();
            }
            setForeground(fgColor);
            setBackground(bgColor);

            setFont(header.getFont());

            isPaintingForPrint = header.isPaintingForPrint();
        }

        if (!isPaintingForPrint && table.getRowSorter() != null) {
            if (!horizontalTextPositionSet) {
                // There is a row sorter, and the developer hasn't
                // set a text position, change to leading.
                setHorizontalTextPosition(JLabel.LEADING);
            }
            SortOrder sortOrder = getColumnSortOrder(table, column);
            if (sortOrder != null) {
                switch(sortOrder) {
                case ASCENDING:
                    sortIcon = DefaultLookup.getIcon(
                        this, ui, "Table.ascendingSortIcon");
                    break;
                case DESCENDING:
                    sortIcon = DefaultLookup.getIcon(
                        this, ui, "Table.descendingSortIcon");
                    break;
                case UNSORTED:
                    sortIcon = DefaultLookup.getIcon(
                        this, ui, "Table.naturalSortIcon");
                    break;
                }
            }
        }
    }

    setText(value == null ? "" : value.toString());
    setIcon(sortIcon);
    sortArrow = sortIcon;

    Border border = null;
    if (hasFocus) {
        border = DefaultLookup.getBorder(this, ui, "TableHeader.focusCellBorder");
    }
    if (border == null) {
        border = DefaultLookup.getBorder(this, ui, "TableHeader.cellBorder");
    }
    setBorder(border);

    return this;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:71,代码来源:DefaultTableCellHeaderRenderer.java

示例4: getListCellRendererComponent

import sun.swing.DefaultLookup; //导入方法依赖的package包/类
public Component getListCellRendererComponent(
    JList<?> list,
    Object value,
    int index,
    boolean isSelected,
    boolean cellHasFocus)
{
    setComponentOrientation(list.getComponentOrientation());

    Color bg = null;
    Color fg = null;

    JList.DropLocation dropLocation = list.getDropLocation();
    if (dropLocation != null
            && !dropLocation.isInsert()
            && dropLocation.getIndex() == index) {

        bg = DefaultLookup.getColor(this, ui, "List.dropCellBackground");
        fg = DefaultLookup.getColor(this, ui, "List.dropCellForeground");

        isSelected = true;
    }

    if (isSelected) {
        setBackground(bg == null ? list.getSelectionBackground() : bg);
        setForeground(fg == null ? list.getSelectionForeground() : fg);
    }
    else {
        setBackground(list.getBackground());
        setForeground(list.getForeground());
    }

    if (value instanceof Icon) {
        setIcon((Icon)value);
        setText("");
    }
    else {
        setIcon(null);
        setText((value == null) ? "" : value.toString());
    }

    setEnabled(list.isEnabled());
    setFont(list.getFont());

    Border border = null;
    if (cellHasFocus) {
        if (isSelected) {
            border = DefaultLookup.getBorder(this, ui, "List.focusSelectedCellHighlightBorder");
        }
        if (border == null) {
            border = DefaultLookup.getBorder(this, ui, "List.focusCellHighlightBorder");
        }
    } else {
        border = getNoFocusBorder();
    }
    setBorder(border);

    return this;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:60,代码来源:DefaultListCellRenderer.java


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