Example usage for weka.gui JTableHelper scrollToVisible

List of usage examples for weka.gui JTableHelper scrollToVisible

Introduction

In this page you can find the example usage for weka.gui JTableHelper scrollToVisible.

Prototype

public static void scrollToVisible(JTable table, int row, int col) 

Source Link

Document

Assumes table is contained in a JScrollPane.

Usage

From source file:meka.gui.dataviewer.DataViewerMainPanel.java

License:Open Source License

/**
 * displays all the attributes, returns the selected item or NULL if canceled
 *
 * @return the name of the selected attribute
 *//*from   ww  w.  java 2s. com*/
public String showAttributes() {
    DataSortedTableModel model;
    ListSelectorDialog dialog;
    int i;
    JList list;
    String name;
    int result;

    if (!isPanelSelected()) {
        return null;
    }

    list = new JList(getCurrentPanel().getAttributes());
    dialog = new ListSelectorDialog(getParentFrame(), list);
    result = dialog.showDialog();

    if (result == ListSelectorDialog.APPROVE_OPTION) {
        model = (DataSortedTableModel) getCurrentPanel().getTable().getModel();
        name = list.getSelectedValue().toString();
        i = model.getAttributeColumn(name);
        JTableHelper.scrollToVisible(getCurrentPanel().getTable(), 0, i);
        getCurrentPanel().getTable().setSelectedColumn(i);
        return name;
    } else {
        return null;
    }
}