List of usage examples for weka.gui JTableHelper scrollToVisible
public static void scrollToVisible(JTable table, int row, int col)
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; } }