本文整理匯總了Java中org.jdesktop.swingx.JXTable.setVisibleColumnCount方法的典型用法代碼示例。如果您正苦於以下問題:Java JXTable.setVisibleColumnCount方法的具體用法?Java JXTable.setVisibleColumnCount怎麽用?Java JXTable.setVisibleColumnCount使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.jdesktop.swingx.JXTable
的用法示例。
在下文中一共展示了JXTable.setVisibleColumnCount方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: interactiveTableBorderHighlighter
import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
* Show variants of border Highlighters.
*
*/
public void interactiveTableBorderHighlighter() {
JXTable table = new JXTable(tableModel);
table.setVisibleRowCount(table.getRowCount());
table.setVisibleColumnCount(7);
table.packAll();
table.setColumnControlVisible(true);
BorderHighlighter outer = new BorderHighlighter(new HighlightPredicate.ColumnHighlightPredicate(1),
BorderFactory.createLineBorder(Color.RED, 3));
BorderHighlighter inner = new BorderHighlighter(new HighlightPredicate.ColumnHighlightPredicate(2),
BorderFactory.createLineBorder(Color.RED, 3), true, true);
BorderHighlighter replace = new BorderHighlighter(new HighlightPredicate.ColumnHighlightPredicate(0),
BorderFactory.createLineBorder(Color.RED, 3), false, true);
table.setHighlighters(outer, inner, replace);
showWithScrollingInFrame(table, "Border Highlighters");
}
示例2: interactiveTablePatternHighlighterJP
import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
* Multiple Highlighters (shown as example in Javapolis 2007).
*
*/
public void interactiveTablePatternHighlighterJP() {
JXTable table = new JXTable(tableModel);
table.setVisibleRowCount(table.getRowCount());
table.setVisibleColumnCount(7);
table.packAll();
table.setColumnControlVisible(true);
Font font = table.getFont().deriveFont(Font.BOLD | Font.ITALIC);
Highlighter simpleStriping = HighlighterFactory.createSimpleStriping();
PatternPredicate patternPredicate = new PatternPredicate("^M", 1);
ColorHighlighter magenta = new ColorHighlighter(patternPredicate, null,
Color.MAGENTA, null, Color.MAGENTA);
FontHighlighter derivedFont = new FontHighlighter(patternPredicate,
font);
AbstractHighlighter gradient = createRelativeGradientHighlighter(HorizontalAlignment.LEFT, AncientSwingTeam.INTEGER_COLUMN);
gradient.setHighlightPredicate(new HighlightPredicate.ColumnHighlightPredicate(AncientSwingTeam.INTEGER_COLUMN));
LOG.info("" + (table.getValueAt(0, 3) instanceof Number));
Highlighter shading = new ShadingColorHighlighter(
new HighlightPredicate.ColumnHighlightPredicate(1));
table.setHighlighters(simpleStriping, magenta, derivedFont, shading //);
, gradient);
showWithScrollingInFrame(table, "Multiple Highlighters");
}
示例3: interactiveXLabelRenderer
import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
* Quick example of using a JXLabel as rendering component.
* Looks funny .. wrapping jumps?
*/
public void interactiveXLabelRenderer() {
DefaultTableModel model = new DefaultTableModel(0, 1);
model.addRow(new String[] {"some really, maybe really really long text - "
+ "wrappit .... where needed "});
model.addRow(new String[] {"another really, maybe really really long text - "
+ "with nothing but junk. wrappit .... where needed"});
JXTable table = new JXTable(model);
table.setVisibleRowCount(4);
table.setVisibleColumnCount(2);
table.setColumnControlVisible(true);
table.getColumnExt(0).setCellRenderer(new DefaultTableRenderer(new XLabelProvider()));
table.addHighlighter(
HighlighterFactory.createAlternateStriping());
table.setRowHeight(50);
showWithScrollingInFrame(table, "textArea as rendering comp");
}
示例4: interactiveDatePickerCellEditorXTable
import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
* Issue ??-swingx: picker cell editor popup commit/cancel
* transfers focus out-off the table (1.5)
*
* Looks like a core issue - editable combo misbehaves as well.
* Here we use a JXTable.
*/
public void interactiveDatePickerCellEditorXTable() {
final JXTable table = new JXTable(createTableModel(2));
table.setVisibleColumnCount(6);
// table.setSurrendersFocusOnKeystroke(true);
installEditors(table);
Action action = new AbstractAction("toggle terminate") {
public void actionPerformed(ActionEvent e) {
table.setTerminateEditOnFocusLost(!table.isTerminateEditOnFocusLost());
}
};
JXFrame frame = wrapWithScrollingInFrame(table, "JXTable - date picker cell editor");
addAction(frame, action);
frame.add(new JXDatePicker(), BorderLayout.SOUTH);
show(frame);
}