當前位置: 首頁>>代碼示例>>Java>>正文


Java JXTable.setSortable方法代碼示例

本文整理匯總了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);
}
 
開發者ID:Petikoch,項目名稱:Java_MVVM_with_Swing_and_RxJava_Examples,代碼行數:33,代碼來源:Example_7a_View.java

示例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);
}
 
開發者ID:Petikoch,項目名稱:Java_MVVM_with_Swing_and_RxJava_Examples,代碼行數:33,代碼來源:Example_7_View.java

示例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);
}
 
開發者ID:Petikoch,項目名稱:Java_MVVM_with_Swing_and_RxJava_Examples,代碼行數:33,代碼來源:Example_8_View.java


注:本文中的org.jdesktop.swingx.JXTable.setSortable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。