Java Code Examples for sun.swing.DefaultLookup#getIcon()

The following examples show how to use sun.swing.DefaultLookup#getIcon() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultTableCellHeaderRenderer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
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;
}
 
Example 2
Source File: DefaultTableCellHeaderRenderer.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
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;
}
 
Example 3
Source File: DefaultTableCellHeaderRenderer.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
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;
}
 
Example 4
Source File: DefaultTableCellHeaderRenderer.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
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;
}
 
Example 5
Source File: DefaultTreeCellRenderer.java    From Bytecoder with Apache License 2.0 2 votes vote down vote up
/**
  * Returns the default icon, for the current laf, that is used to
  * represent non-leaf nodes that are not expanded.
  *
  * @return the default icon, for the current laf, that is used to
  *         represent non-leaf nodes that are not expanded.
  */
public Icon getDefaultClosedIcon() {
    return DefaultLookup.getIcon(this, ui, "Tree.closedIcon");
}
 
Example 6
Source File: DefaultTreeCellRenderer.java    From jdk8u-jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
  * Returns the default icon, for the current laf, that is used to
  * represent leaf nodes.
  */
public Icon getDefaultLeafIcon() {
    return DefaultLookup.getIcon(this, ui, "Tree.leafIcon");
}
 
Example 7
Source File: DefaultTreeCellRenderer.java    From openjdk-8-source with GNU General Public License v2.0 2 votes vote down vote up
/**
  * Returns the default icon, for the current laf, that is used to
  * represent leaf nodes.
  */
public Icon getDefaultLeafIcon() {
    return DefaultLookup.getIcon(this, ui, "Tree.leafIcon");
}
 
Example 8
Source File: DefaultTreeCellRenderer.java    From JDKSourceCode1.8 with MIT License 2 votes vote down vote up
/**
  * Returns the default icon, for the current laf, that is used to
  * represent non-leaf nodes that are expanded.
  */
public Icon getDefaultOpenIcon() {
    return DefaultLookup.getIcon(this, ui, "Tree.openIcon");
}
 
Example 9
Source File: DefaultTreeCellRenderer.java    From openjdk-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
  * Returns the default icon, for the current laf, that is used to
  * represent non-leaf nodes that are not expanded.
  */
public Icon getDefaultClosedIcon() {
    return DefaultLookup.getIcon(this, ui, "Tree.closedIcon");
}
 
Example 10
Source File: DefaultTreeCellRenderer.java    From jdk8u60 with GNU General Public License v2.0 2 votes vote down vote up
/**
  * Returns the default icon, for the current laf, that is used to
  * represent non-leaf nodes that are not expanded.
  */
public Icon getDefaultClosedIcon() {
    return DefaultLookup.getIcon(this, ui, "Tree.closedIcon");
}
 
Example 11
Source File: DefaultTreeCellRenderer.java    From hottub with GNU General Public License v2.0 2 votes vote down vote up
/**
  * Returns the default icon, for the current laf, that is used to
  * represent non-leaf nodes that are expanded.
  */
public Icon getDefaultOpenIcon() {
    return DefaultLookup.getIcon(this, ui, "Tree.openIcon");
}
 
Example 12
Source File: DefaultTreeCellRenderer.java    From jdk8u-dev-jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
  * Returns the default icon, for the current laf, that is used to
  * represent non-leaf nodes that are expanded.
  */
public Icon getDefaultOpenIcon() {
    return DefaultLookup.getIcon(this, ui, "Tree.openIcon");
}
 
Example 13
Source File: DefaultTreeCellRenderer.java    From hottub with GNU General Public License v2.0 2 votes vote down vote up
/**
  * Returns the default icon, for the current laf, that is used to
  * represent non-leaf nodes that are not expanded.
  */
public Icon getDefaultClosedIcon() {
    return DefaultLookup.getIcon(this, ui, "Tree.closedIcon");
}
 
Example 14
Source File: DefaultTreeCellRenderer.java    From Bytecoder with Apache License 2.0 2 votes vote down vote up
/**
  * Returns the default icon, for the current laf, that is used to
  * represent non-leaf nodes that are expanded.
  *
  * @return the default icon, for the current laf, that is used to
  *         represent non-leaf nodes that are expanded.
  */
public Icon getDefaultOpenIcon() {
    return DefaultLookup.getIcon(this, ui, "Tree.openIcon");
}
 
Example 15
Source File: DefaultTreeCellRenderer.java    From Java8CN with Apache License 2.0 2 votes vote down vote up
/**
  * Returns the default icon, for the current laf, that is used to
  * represent non-leaf nodes that are not expanded.
  */
public Icon getDefaultClosedIcon() {
    return DefaultLookup.getIcon(this, ui, "Tree.closedIcon");
}
 
Example 16
Source File: DefaultTreeCellRenderer.java    From jdk8u-jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
  * Returns the default icon, for the current laf, that is used to
  * represent non-leaf nodes that are expanded.
  */
public Icon getDefaultOpenIcon() {
    return DefaultLookup.getIcon(this, ui, "Tree.openIcon");
}
 
Example 17
Source File: DefaultTreeCellRenderer.java    From openjdk-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
  * Returns the default icon, for the current laf, that is used to
  * represent leaf nodes.
  */
public Icon getDefaultLeafIcon() {
    return DefaultLookup.getIcon(this, ui, "Tree.leafIcon");
}
 
Example 18
Source File: DefaultTreeCellRenderer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 2 votes vote down vote up
/**
  * Returns the default icon, for the current laf, that is used to
  * represent non-leaf nodes that are expanded.
  */
public Icon getDefaultOpenIcon() {
    return DefaultLookup.getIcon(this, ui, "Tree.openIcon");
}
 
Example 19
Source File: DefaultTreeCellRenderer.java    From jdk1.8-source-analysis with Apache License 2.0 2 votes vote down vote up
/**
  * Returns the default icon, for the current laf, that is used to
  * represent leaf nodes.
  */
public Icon getDefaultLeafIcon() {
    return DefaultLookup.getIcon(this, ui, "Tree.leafIcon");
}
 
Example 20
Source File: DefaultTreeCellRenderer.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
/**
  * Returns the default icon, for the current laf, that is used to
  * represent leaf nodes.
  */
public Icon getDefaultLeafIcon() {
    return DefaultLookup.getIcon(this, ui, "Tree.leafIcon");
}