• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java DatePickerCellEditor类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中org.jdesktop.swingx.table.DatePickerCellEditor的典型用法代码示例。如果您正苦于以下问题:Java DatePickerCellEditor类的具体用法?Java DatePickerCellEditor怎么用?Java DatePickerCellEditor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

DatePickerCellEditor类属于org.jdesktop.swingx.table包,在下文中一共展示了DatePickerCellEditor类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: interactiveUpdateUIEditors

点赞 3

import org.jdesktop.swingx.table.DatePickerCellEditor; //导入依赖的package包/类
/**
 * Issue #908-swingx: move updateUI responsibility into column.
 * 
 */
public void interactiveUpdateUIEditors() {
    DefaultTableModel model = new DefaultTableModel(5, 5) {

        @Override
        public Class<?> getColumnClass(int columnIndex) {
            if (getValueAt(0, columnIndex) == null)
                return super.getColumnClass(columnIndex);
            return getValueAt(0, columnIndex).getClass();
        }
        
    };
    for (int i = 0; i < model.getRowCount(); i++) {
        model.setValueAt(new Date(), i, 0);
        model.setValueAt(true, i, 1);
    }
    JXTable table = new JXTable(model);
    TableCellEditor editor = new DatePickerCellEditor();
    table.getColumn(0).setCellEditor(editor);
    table.getColumn(4).setCellRenderer(new DefaultTableRenderer(new CheckBoxProvider()));
    showWithScrollingInFrame(table, "toggle ui - must update editors/renderers");
}
 

开发者ID:RockManJoe64,
项目名称:swingx,
代码行数:26,
代码来源:JXTableVisualCheck.java

示例2: createTableWithEditor

点赞 2

import org.jdesktop.swingx.table.DatePickerCellEditor; //导入依赖的package包/类
private JTable createTableWithEditor(TableModel model, String name) {
        JTable table = new JXTable(model);
//        table.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
        DatePickerCellEditor editor = new DatePickerCellEditor();
        editor.getTableCellEditorComponent(table, null, false, 0, 0).setName(name);
        editor.setClickCountToStart(1);
        table.setDefaultEditor(Date.class, editor);
        return table;
    }
 

开发者ID:RockManJoe64,
项目名称:swingx,
代码行数:10,
代码来源:JXDatePickerIssues.java

示例3: interactiveMixedColumnEditors

点赞 2

import org.jdesktop.swingx.table.DatePickerCellEditor; //导入依赖的package包/类
/**
     * Issue #1236-swingx: NumberEditorExt only handles columns with type
     *    Number.
     *    
     * Perceived as overly restrictive, fails f.i. in usage in property sheet.   
     * 
     */
//    @Test
    public void interactiveMixedColumnEditors() {
        // mixed types in column
        Object[] values = new Object[] {new Integer(10), new Double(10.5), new Date(),
                new JLabel("dummy"),
                new Point(4, 6)};
        DefaultTableModel model = new DefaultTableModel(10, 2) {

            @Override
            public Class<?> getColumnClass(int columnIndex) {
                if (columnIndex == getColumnCount() - 1) {
                    return Point.class;
                }
                return super.getColumnClass(columnIndex);
            }
            
        };
        for (int i = 0; i < values.length; i++) {
            model.setValueAt(values[i], i, 0);
            model.setValueAt(new Point(1, i), i, 1);
        }
        
        JXTable table = new JXTable(model) {

            @Override
            public TableCellEditor getCellEditor(int row, int column) {
                Object value = getValueAt(row, column);
                if (value instanceof Number) {
                    return getDefaultEditor(Number.class);
                }
                if (value instanceof Date) {
                    return getDefaultEditor(Date.class);
                }
                if (value instanceof JLabel) {
                    // pathological: something with a string param constructor
                    return getDefaultEditor(Number.class);
                }
                return super.getCellEditor(row, column);
            }
            
        };
        table.setDefaultEditor(Date.class, new DatePickerCellEditor());
//        table.setDefaultEditor(Number.class, new NumberEditorExt(false));
        JXFrame frame = showWithScrollingInFrame(table, "per-cell number editor? ");
        JFormattedTextField field = new JFormattedTextField(new Date());
        addStatusComponent(frame, field);
    }
 

开发者ID:RockManJoe64,
项目名称:swingx,
代码行数:55,
代码来源:NumberEditorExtIssues.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)