當前位置: 首頁>>代碼示例>>Java>>正文


Java JTable.getForeground方法代碼示例

本文整理匯總了Java中javax.swing.JTable.getForeground方法的典型用法代碼示例。如果您正苦於以下問題:Java JTable.getForeground方法的具體用法?Java JTable.getForeground怎麽用?Java JTable.getForeground使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.JTable的用法示例。


在下文中一共展示了JTable.getForeground方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getDefaultCellStyle

import javax.swing.JTable; //導入方法依賴的package包/類
public static TableCellStyle getDefaultCellStyle(JTable table, IssueTable issueTable, IssueProperty p, boolean isSelected, int row) {
    // set default values
    return new TableCellStyle(
        null,                                                                       // format
        isSelected ? table.getSelectionBackground() : getUnselectedBackground(row), // background
        isSelected ? Color.WHITE : table.getForeground(),                           // foreground
        null,                                                                       // tooltip
        getHightlightPattern(issueTable, p)
    );
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,代碼來源:QueryTableCellRenderer.java

示例2: getTableCellRendererComponent

import javax.swing.JTable; //導入方法依賴的package包/類
public Component getTableCellRendererComponent(final JTable table,
                                               final Object value, final boolean isSelected,
                                               final boolean hasFocus, final int row, final int column) {
    if (isSelected) {
        super.setForeground(table.getSelectionForeground());
        super.setBackground(table.getSelectionBackground());
    } else {
        super.setForeground(table.getForeground());
        super.setBackground(table.getBackground());
    }

    setFont(table.getFont());

    if (hasFocus) {
        Border border = null;
        if (isSelected) {
            border = UIManager
                    .getBorder("Table.focusSelectedCellHighlightBorder");
        }
        if (border == null) {
            border = UIManager
                    .getBorder("Table.focusCellHighlightBorder");
        }
        setBorder(border);
    } else {
        setBorder(noFocusBorder);
    }
    return this;
}
 
開發者ID:Vitaliy-Yakovchuk,項目名稱:ramus,代碼行數:30,代碼來源:SectorRowsEditor.java

示例3: getTableCellRendererComponent

import javax.swing.JTable; //導入方法依賴的package包/類
@Override
public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column ) {
    renderer.clear();
    Rectangle rect = table.getCellRect( row, column, true );
    renderer.setSize( rect.width, rect.height );
    if( value instanceof TabData ) {
        TabData tab = ( TabData ) value;
        String text = tab.getText();
        Icon icon = tab.getIcon();
        Color colBackground = isSelected ? table.getSelectionBackground() : table.getBackground();
        Color colForeground = isSelected ? table.getSelectionForeground() : table.getForeground();

        for( TabDecorator td : decorators ) {
            Color c = td.getBackground( tab, isSelected );
            if( null != c )
                colBackground = c;
            c = td.getForeground( tab, isSelected );
            if( null != c )
                colForeground = c;

            String s = td.getText( tab );
            if( null != s )
                text = s;

            Icon i = td.getIcon( tab );
            if( null != i ) {
                icon = i;
            }
        }
        renderer.label.setText( text );
        renderer.label.setIcon( icon );
        renderer.label.setFont( table.getFont() );
        renderer.setBackground( colBackground );
        renderer.label.setForeground( colForeground );
        renderer.tabData = tab;
        renderer.isSelected = isSelected;

        if( table instanceof TabTable ) {
            TabTable tabTable = ( TabTable ) table;
            if( isClosable(tab) ) {
                boolean inCloseButton = tabTable.isCloseButtonHighlighted( row, column );
                renderer.closeButton.setVisible( true );
                renderer.closeButton.getModel().setRollover( inCloseButton );
                renderer.closeButton.getModel().setArmed( inCloseButton );
            } else {
                renderer.closeButton.setVisible( false );
            }
        }
    }
    return renderer;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:52,代碼來源:TabDataRenderer.java

示例4: getTableCellRendererComponent

import javax.swing.JTable; //導入方法依賴的package包/類
public Component getTableCellRendererComponent(JTable table, Object value,
        boolean isSelected, boolean hasFocus, int row, int column) {
    if (value == null) {
        return new DefaultTableCellRenderer().getTableCellRendererComponent(table, value,
                isSelected, hasFocus, row, column);
    }

    if (isSelected) {
        super.setForeground(table.getSelectionForeground());
        super.setBackground(table.getSelectionBackground());
    } else {
        super.setForeground(table.getForeground());
        super.setBackground(table.getBackground());
    }

    setFont(table.getFont());

    if (hasFocus) {
        Border border = null;
        if (isSelected) {
            border = UIManager.getBorder("Table.focusSelectedCellHighlightBorder"); // NOI18N
        }
        if (border == null) {
            border = UIManager.getBorder("Table.focusCellHighlightBorder"); // NOI18N
        }
        setBorder(border);
    } else {
        setBorder(new EmptyBorder(1, 1, 1, 1));
    }


    FileCoverageSummary summary = (FileCoverageSummary) table.getValueAt(row, -1);
    FileObject file = summary.getFile();

    setText(summary.getDisplayName());
    if (file != null && file.isValid()) {
        try {
            DataObject dobj = DataObject.find(file);
            Node node = dobj.getNodeDelegate();
            Image icon = node.getIcon(BeanInfo.ICON_COLOR_32x32);
            setIcon(new ImageIcon(icon));
        } catch (DataObjectNotFoundException ex) {
            Exceptions.printStackTrace(ex);
        }
    } else {
        setIcon(null);
    }


    return this;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:52,代碼來源:CoverageReportTopComponent.java


注:本文中的javax.swing.JTable.getForeground方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。