Pencarian

Selasa, 26 November 2013

Java Jtable remap cell value when type (netbeans)

Catatan dihari tua.
Java Jtable : Ketika cell di select, value akan di replace oleh keypress (Seperti di Spreedsheet).
Netbeans Customize Code untuk jtable
tbl_detail = new javax.swing.JTable(){
    public boolean editCellAt(int row, int column, EventObject e){
        boolean result = super.editCellAt(row, column, e);
        final Component editor = getEditorComponent();
        if (editor == null || !(editor instanceof JTextComponent)) {
            return result;
        }
        if (e instanceof KeyEvent) {
            ((JTextComponent) editor).selectAll();
        }
        return result;
    }
};

Tidak ada komentar:

Posting Komentar