All Downloads are FREE. Search and download functionalities are using the official Maven repository.

se.cambio.openehr.view.util.TabTableAction Maven / Gradle / Ivy

There is a newer version: 1.3.26
Show newest version
package se.cambio.openehr.view.util;

import javax.swing.*;
import java.awt.event.ActionEvent;

/**
 * User: Iago.Corbal
 * Date: 2013-11-11
 * Time: 20:02
 */
public class TabTableAction extends AbstractAction {

    private static final long serialVersionUID = 0L;
    private Action _oldTabAction = null;
    private JTable _table = null;

    public TabTableAction(JTable table, Action oldTabAction) {
        _oldTabAction = oldTabAction;
        _table = table;
    }

    public void actionPerformed(ActionEvent ev) {
        int row = _table.getSelectedRow();
        int col = _table.getSelectedColumn();
        if (_oldTabAction != null) {
            _oldTabAction.actionPerformed(ev);
        }
        int rowCount = _table.getRowCount();
        if (row < rowCount - 1) {
            row++;
        }
        _table.changeSelection(row, col, false, false);
        _table.editCellAt(row, col);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy