本文整理匯總了Java中org.jdesktop.swingx.JXTable.setSortable方法的典型用法代碼示例。如果您正苦於以下問題:Java JXTable.setSortable方法的具體用法?Java JXTable.setSortable怎麽用?Java JXTable.setSortable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.jdesktop.swingx.JXTable
的用法示例。
在下文中一共展示了JXTable.setSortable方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: Example_7a_View
import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
public Example_7a_View() {
super();
setTitle(getClass().getSimpleName() + " " + ManagementFactory.getRuntimeMXBean().getName());
setBounds(100, 100, 700, 500);
setDefaultCloseOperation(StrictThreadingJFrame.EXIT_ON_CLOSE);
getContentPane().setLayout(new BorderLayout(0, 0));
final JXTable table = new JXTable(myTableModel);
table.setHighlighters(HighlighterFactory.createSimpleStriping());
table.setSortable(false);
table.getTableHeader().setReorderingAllowed(false);
myTableModel.addTableModelListener(new TableModelListener() {
int lastRowCountScrolledTo = -1;
@Override
public void tableChanged(final TableModelEvent e) {
if (TableUtilities.isInsert(e)) {
final int currentRowCount = myTableModel.getRowCount();
if (currentRowCount != lastRowCountScrolledTo) {
lastRowCountScrolledTo = currentRowCount;
SwingUtilities.invokeLater(() -> table.scrollRectToVisible(table.getCellRect(myTableModel.getRowCount() - 1, 0, false)));
}
}
}
});
JScrollPane scrollPane = new JScrollPane(table);
getContentPane().add(scrollPane, BorderLayout.CENTER);
}
示例2: Example_7_View
import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
public Example_7_View() {
super();
setTitle(getClass().getSimpleName() + " " + ManagementFactory.getRuntimeMXBean().getName());
setBounds(100, 100, 700, 500);
setDefaultCloseOperation(StrictThreadingJFrame.EXIT_ON_CLOSE);
getContentPane().setLayout(new BorderLayout(0, 0));
final JXTable table = new JXTable(myTableModel);
table.setHighlighters(HighlighterFactory.createSimpleStriping());
table.setSortable(false);
table.getTableHeader().setReorderingAllowed(false);
myTableModel.addTableModelListener(new TableModelListener() {
int lastRowCountScrolledTo = -1;
@Override
public void tableChanged(final TableModelEvent e) {
if (TableUtilities.isInsert(e)) {
final int currentRowCount = myTableModel.getRowCount();
if (currentRowCount != lastRowCountScrolledTo) {
lastRowCountScrolledTo = currentRowCount;
SwingUtilities.invokeLater(() -> table.scrollRectToVisible(table.getCellRect(myTableModel.getRowCount() - 1, 0, false)));
}
}
}
});
JScrollPane scrollPane = new JScrollPane(table);
getContentPane().add(scrollPane, BorderLayout.CENTER);
}
示例3: Example_8_View
import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
public Example_8_View() {
super();
setTitle(getClass().getSimpleName() + " " + ManagementFactory.getRuntimeMXBean().getName());
setBounds(100, 100, 700, 500);
setDefaultCloseOperation(StrictThreadingJFrame.EXIT_ON_CLOSE);
getContentPane().setLayout(new BorderLayout(0, 0));
final JXTable table = new JXTable(myTableModel);
table.setHighlighters(HighlighterFactory.createSimpleStriping());
table.setSortable(false);
table.getTableHeader().setReorderingAllowed(false);
myTableModel.addTableModelListener(new TableModelListener() {
int lastRowCountScrolledTo = -1;
@Override
public void tableChanged(final TableModelEvent e) {
if (TableUtilities.isInsert(e)) {
final int currentRowCount = myTableModel.getRowCount();
if (currentRowCount != lastRowCountScrolledTo) {
lastRowCountScrolledTo = currentRowCount;
SwingUtilities.invokeLater(() -> table.scrollRectToVisible(table.getCellRect(myTableModel.getRowCount() - 1, 0, false)));
}
}
}
});
JScrollPane scrollPane = new JScrollPane(table);
getContentPane().add(scrollPane, BorderLayout.CENTER);
}