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


Java JXTable.setColumnControl方法代碼示例

本文整理匯總了Java中org.jdesktop.swingx.JXTable.setColumnControl方法的典型用法代碼示例。如果您正苦於以下問題:Java JXTable.setColumnControl方法的具體用法?Java JXTable.setColumnControl怎麽用?Java JXTable.setColumnControl使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.jdesktop.swingx.JXTable的用法示例。


在下文中一共展示了JXTable.setColumnControl方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testNullVisibilityAction

import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
 * Tests if subclasses are allowed to not create a visibility action.
 * This might happen if they want to exempt certain columns from 
 * user interaction.
 *
 */
@Test
public void testNullVisibilityAction() {
    JXTable table = new JXTable();
    ColumnControlButton columnControl = new ColumnControlButton(table) {

                @Override
                protected ColumnVisibilityAction createColumnVisibilityAction(TableColumn column) {
                    if (column.getModelIndex() == 0) return null;
                    return super.createColumnVisibilityAction(column);
                }
        
        
    };
    table.setColumnControl(columnControl);
    table.setColumnControlVisible(true);
    table.setModel(sortableTableModel);
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:24,代碼來源:ColumnControlButtonTest.java

示例2: interactiveCustomColumnAction

import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
public void interactiveCustomColumnAction() {
    JXTable table = new JXTable(new AncientSwingTeam());
    ColumnControlButton control = new ColumnControlButton(table) {

        /**
         * @inherited <p>
         */
        @Override
        protected ColumnControlPopup createColumnControlPopup() {
            ColumnControlPopup controlPopup = new DefaultColumnControlPopup() {

                /**
                 * @inherited <p>
                 */
                @Override
                public void addAdditionalActionItems(
                        List<? extends Action> actions) {
                    super.addAdditionalActionItems(actions);
                    String commands = "commands: ";
                    for (Action action : actions) {
                        commands += action
                                .getValue(Action.ACTION_COMMAND_KEY);
                    }
                    LOG.info(commands);
                }

            };
            return controlPopup;
        }

    };
    table.setColumnControl(control);
    table.setColumnControlVisible(true);
    showWithScrollingInFrame(table, "custom control");

}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:37,代碼來源:ColumnControlButtonVisualCheck.java

示例3: interactiveNullVisibilityActionWithHideable

import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
 * test if subclasses are allowed to not create a visibility action. This
 * might happen, if they want to exempt certain columns from user
 * interaction.
 * 
 */
public void interactiveNullVisibilityActionWithHideable() {
    JXTable table = new JXTable();
    ColumnControlButton columnControl = new ColumnControlButton(table) {
        
        @Override
        protected ColumnVisibilityAction createColumnVisibilityAction(
                TableColumn column) {
            if (column instanceof TableColumnExt
                    && !((TableColumnExt) column).isHideable())
                return null;
            return super.createColumnVisibilityAction(column);
        }
        
    };
    table.setColumnControl(columnControl);
    table.setColumnControlVisible(true);
    ColumnFactory factory = new ColumnFactory() {
        
        /**
         * @inherited <p>
         */
        @Override
        public void configureTableColumn(TableModel model,
                TableColumnExt columnExt) {
            super.configureTableColumn(model, columnExt);
            if (columnExt.getModelIndex() == 0) {
                columnExt.setHideable(false);
            }
        }
        
    };
    table.setColumnFactory(factory);
    table.setModel(new AncientSwingTeam());
    JXFrame frame = wrapWithScrollingInFrame(table,
            "first model column not togglable");
    frame.setVisible(true);
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:44,代碼來源:ColumnControlButtonVisualCheck.java


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