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


Java JTable.getDefaultRenderer方法代码示例

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


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

示例1: getTableCellRendererComponent

import javax.swing.JTable; //导入方法依赖的package包/类
@Override
public Component getTableCellRendererComponent(JTable table,
                                               Object value, boolean isSelected, boolean hasFocus, int row,
                                               int column) {
    Component component = super.getTableCellRendererComponent(table,
            value, isSelected, hasFocus, row, column);
    if (value != null) {
        if (component instanceof JLabel)
            ((JLabel) component)
                    .setText(DateAttributePlugin.DATE_INSTANCE
                            .format(value));
        else {
            TableCellRenderer renderer = table
                    .getDefaultRenderer(Date.class);
            return renderer.getTableCellRendererComponent(table, value,
                    isSelected, hasFocus, row, column);
        }
    }
    return component;
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:21,代码来源:PriceEditComponent.java

示例2: getTableCellRendererComponent

import javax.swing.JTable; //导入方法依赖的package包/类
@Override
public Component getTableCellRendererComponent(JTable table,
                                               Object value, boolean isSelected, boolean hasFocus, int row,
                                               int column) {
    Component component = super.getTableCellRendererComponent(table,
            value, isSelected, hasFocus, row, column);
    if (value != null) {
        if (component instanceof JLabel)
            ((JLabel) component).setText(DATE_INSTANCE.format(value));
        else {
            TableCellRenderer renderer = table
                    .getDefaultRenderer(Date.class);
            return renderer.getTableCellRendererComponent(table, value,
                    isSelected, hasFocus, row, column);
        }
    }
    return component;
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:19,代码来源:DateAttributePlugin.java

示例3: apply

import javax.swing.JTable; //导入方法依赖的package包/类
/**
 * Applies DisablingCellRenderer to all cell renderers in the table.
 * @param t the table
 * @param disabled if the table content should be disabled
 */
public static void apply(JTable t, Color background) {
    int nc = t.getColumnModel().getColumnCount();
    for (int i = 0; i < nc; i++) {
        TableCellRenderer columnRenderer = t.getColumnModel().getColumn(i).getCellRenderer();
        if (columnRenderer == null) columnRenderer = t.getDefaultRenderer(t.getColumnClass(i));
        t.getColumnModel().getColumn(i).setCellRenderer(
            new DisablingCellRenderer(columnRenderer, t, background));
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:DisablingCellRenderer.java

示例4: getTableCellRendererComponent

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

    if (impl == null) impl = table.getDefaultRenderer(table.getColumnClass(column));
    
    value = formatValue(table, value, isSelected, hasFocus, row, column);
    Component c = impl.getTableCellRendererComponent(table, value, isSelected,
                                                     hasFocus, row, column);
    updateRenderer(c, table, value, isSelected, hasFocus, row, column);

    return c;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:DetailsTableCellRenderer.java

示例5: getTableCellRendererComponent

import javax.swing.JTable; //导入方法依赖的package包/类
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
    TableCellRenderer def = table.getDefaultRenderer(table.getColumnClass(column));
    if (!table.isEnabled()) {
        isSelected = hasFocus = false;
    }
    JComponent c = (JComponent)def.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
    c.setEnabled(table.isEnabled());
    
    return c;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:ClassNameList.java

示例6: AttrTable

import javax.swing.JTable; //导入方法依赖的package包/类
public AttrTable(Window parent) {
	super(new BorderLayout());
	this.parent = parent;

	titleEnabled = true;
	title = new TitleLabel();
	title.setHorizontalAlignment(SwingConstants.CENTER);
	title.setVerticalAlignment(SwingConstants.CENTER);
	tableModel = new TableModelAdapter(parent, NULL_ATTR_MODEL);
	table = new JTable(tableModel);
	table.setDefaultEditor(Object.class, editor);
	table.setTableHeader(null);
	table.setRowHeight(20);

	Font baseFont = title.getFont();
	int titleSize = Math.round(baseFont.getSize() * 1.2f);
	Font titleFont = baseFont.deriveFont((float) titleSize).deriveFont(Font.BOLD);
	title.setFont(titleFont);
	Color bgColor = new Color(240, 240, 240);
	setBackground(bgColor);
	table.setBackground(bgColor);
	Object renderer = table.getDefaultRenderer(String.class);
	if (renderer instanceof JComponent) {
		((JComponent) renderer).setBackground(Color.WHITE);
	}

	JScrollPane tableScroll = new JScrollPane(table);

	this.add(title, BorderLayout.PAGE_START);
	this.add(tableScroll, BorderLayout.CENTER);
	LocaleManager.addLocaleListener(this);
	localeChanged();
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:34,代码来源:AttrTable.java


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