本文整理匯總了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);
}
示例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");
}
示例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);
}