本文整理汇总了Java中org.jdesktop.swingx.renderer.DefaultTableRenderer类的典型用法代码示例。如果您正苦于以下问题:Java DefaultTableRenderer类的具体用法?Java DefaultTableRenderer怎么用?Java DefaultTableRenderer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DefaultTableRenderer类属于org.jdesktop.swingx.renderer包,在下文中一共展示了DefaultTableRenderer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: interactiveTreeTableLinkRendererSimpleText
import org.jdesktop.swingx.renderer.DefaultTableRenderer; //导入依赖的package包/类
/**
* Issue #??-swingx: hyperlink in JXTreeTable hierarchical column not
* active.
*
*/
public void interactiveTreeTableLinkRendererSimpleText() {
AbstractHyperlinkAction<Object> simpleAction = new AbstractHyperlinkAction<Object>(null) {
@Override
public void actionPerformed(ActionEvent e) {
LOG.info("hit: " + getTarget());
}
};
JXTreeTable tree = new JXTreeTable(new FileSystemModel());
HyperlinkProvider provider = new HyperlinkProvider(simpleAction);
tree.getColumn(2).setCellRenderer(new DefaultTableRenderer(provider));
tree.setTreeCellRenderer(new DefaultTreeRenderer( //provider));
new WrappingProvider(provider)));
// tree.setCellRenderer(new LinkRenderer(simpleAction));
tree.setHighlighters(HighlighterFactory.createSimpleStriping());
JFrame frame = wrapWithScrollingInFrame(tree, "table and simple links");
frame.setVisible(true);
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:26,代码来源:JXTreeTableIssues.java
示例2: testStringValueRegistryFromColumnFactory
import org.jdesktop.swingx.renderer.DefaultTableRenderer; //导入依赖的package包/类
/**
* Issue 1145-swingx: re-enable filter to use string representation.
* Here: test that cell-location StringValue look up initial per-column renderer
*
*/
@Test
public void testStringValueRegistryFromColumnFactory() {
JXTable table = new JXTable();
final int column = 2;
// custom column factory which sets per-column renderer
ColumnFactory factory = new ColumnFactory() {
@Override
public void configureTableColumn(TableModel model,
TableColumnExt columnExt) {
super.configureTableColumn(model, columnExt);
if (columnExt.getModelIndex() == column)
columnExt.setCellRenderer(new DefaultTableRenderer());
}
};
table.setColumnFactory(factory);
table.setModel(createModelDefaultColumnClasses(4));
StringValueRegistry provider = table.getStringValueRegistry();
assertEquals(table.getCellRenderer(0, column), provider.getStringValue(0, column));
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:27,代码来源:JXTableUnitTest.java
示例3: testGetString
import org.jdesktop.swingx.renderer.DefaultTableRenderer; //导入依赖的package包/类
/**
* Issue #767-swingx: consistent string representation.
*
* Here: test api on JXTable.
*/
@Test
public void testGetString() {
JXTable table = new JXTable(new AncientSwingTeam());
StringValue sv = new StringValue() {
@Override
public String getString(Object value) {
if (value instanceof Color) {
Color color = (Color) value;
return "R/G/B: " + color.getRGB();
}
return StringValues.TO_STRING.getString(value);
}
};
table.setDefaultRenderer(Color.class, new DefaultTableRenderer(sv));
String text = table.getStringAt(0, 2);
assertEquals(sv.getString(table.getValueAt(0, 2)), text);
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:25,代码来源:JXTableUnitTest.java
示例4: interactiveRolloverDisabledClickTable
import org.jdesktop.swingx.renderer.DefaultTableRenderer; //导入依赖的package包/类
/**
* Issue #1374-swingx: Rollover click must be disabled if target disabled
*
* Visual test for JXTable, adapted from reporter's test case
*/
public void interactiveRolloverDisabledClickTable() {
JXTable table = new JXTable(new AncientSwingTeam());
table.setEditable(false);
table.setEnabled(false);
final JXFrame frame = showWithScrollingInFrame(table, "disable table must not trigger rollover renderer");
// rollover-enabled default renderer
DefaultTableRenderer renderer = new DefaultTableRenderer() {
@Override
public void doClick() {
JOptionPane.showMessageDialog(frame, "Click");
}
@Override
public boolean isEnabled() {
return true;
}
};
table.setDefaultRenderer(Object.class, renderer);
addEnabledToggle(frame, table);
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:26,代码来源:RolloverVisualCheck.java
示例5: interactiveToolTipOnTruncatedText
import org.jdesktop.swingx.renderer.DefaultTableRenderer; //导入依赖的package包/类
/**
* Issue 1314: visual interaction of truncated text and tool tip highlighter.
*/
public void interactiveToolTipOnTruncatedText() {
JXTable table = new JXTable(new AncientSwingTeam());
final Icon icon = XTestUtils.loadDefaultIcon();
IconValue iv = new IconValue() {
@Override
public Icon getIcon(Object value) {
return icon;
}
};
table.getColumn(AncientSwingTeam.COLOR_COLUMN).setCellRenderer(new DefaultTableRenderer(StringValues.TO_STRING, iv));
table.addHighlighter(new ToolTipHighlighter(HighlightPredicate.IS_TEXT_TRUNCATED));
JXFrame frame = showWithScrollingInFrame(table, "ToolTip on truncated text");
addComponentOrientationToggle(frame);
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:19,代码来源:HighlighterClientVisualCheck.java
示例6: interactiveTableHyperlinkNoTooltip
import org.jdesktop.swingx.renderer.DefaultTableRenderer; //导入依赖的package包/类
/**
* Table url activation, disabled tooltips.
*/
public void interactiveTableHyperlinkNoTooltip() {
JXTable table = new JXTable(createModelWithLinks());
EditorPaneLinkVisitor visitor = new EditorPaneLinkVisitor();
LinkModelAction<?> action = new LinkModelAction<LinkModel>(visitor) {
@Override
protected void updateFromTarget() {
super.updateFromTarget();
putValue(Action.SHORT_DESCRIPTION, null);
}
};
// set the default renderer for LinkModel - which is basically
// a bean wrapped around an URL
table.setDefaultRenderer(LinkModel.class, new DefaultTableRenderer
(new HyperlinkProvider(action, LinkModel.class)));
JXFrame frame = wrapWithScrollingInFrame(table, visitor.getOutputComponent(), "table and simple links");
frame.setVisible(true);
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:23,代码来源:JXHyperlinkVisualCheck.java
示例7: interactiveTableHyperlinkLFStripingHighlighter
import org.jdesktop.swingx.renderer.DefaultTableRenderer; //导入依赖的package包/类
/**
* Check visuals of hyperlink and highlighter.
* Issue #513-swingx: no rollover effect for disabled table.
* Hyperlink is disabled automatically by DefaultVisuals, no need
* to disable the xxRolloverController.
*
*/
public void interactiveTableHyperlinkLFStripingHighlighter() {
EditorPaneLinkVisitor visitor = new EditorPaneLinkVisitor();
final JXTable table = new JXTable(createModelWithLinks());
LinkModelAction<?> action = new LinkModelAction<LinkModel>(visitor);
table.setDefaultRenderer(LinkModel.class, new DefaultTableRenderer
(new HyperlinkProvider(action, LinkModel.class)));
table.setHighlighters(HighlighterFactory.createSimpleStriping());
Action enabled = new AbstractAction("toggle table enabled") {
public void actionPerformed(ActionEvent e) {
table.setEnabled(!table.isEnabled());
}
};
JXFrame frame = wrapWithScrollingInFrame(table, visitor.getOutputComponent(),
"show link renderer in table with LF striping highlighter");
addAction(frame, enabled);
frame.setVisible(true);
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:28,代码来源:JXHyperlinkVisualCheck.java
示例8: interactiveUpdateUIEditors
import org.jdesktop.swingx.renderer.DefaultTableRenderer; //导入依赖的package包/类
/**
* Issue #908-swingx: move updateUI responsibility into column.
*
*/
public void interactiveUpdateUIEditors() {
DefaultTableModel model = new DefaultTableModel(5, 5) {
@Override
public Class<?> getColumnClass(int columnIndex) {
if (getValueAt(0, columnIndex) == null)
return super.getColumnClass(columnIndex);
return getValueAt(0, columnIndex).getClass();
}
};
for (int i = 0; i < model.getRowCount(); i++) {
model.setValueAt(new Date(), i, 0);
model.setValueAt(true, i, 1);
}
JXTable table = new JXTable(model);
TableCellEditor editor = new DatePickerCellEditor();
table.getColumn(0).setCellEditor(editor);
table.getColumn(4).setCellRenderer(new DefaultTableRenderer(new CheckBoxProvider()));
showWithScrollingInFrame(table, "toggle ui - must update editors/renderers");
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:26,代码来源:JXTableVisualCheck.java
示例9: installRenderers
import org.jdesktop.swingx.renderer.DefaultTableRenderer; //导入依赖的package包/类
/**
* Install renderers which use the prepared string representations.
* Note: this method is called after the binding (aka: attach models)
* because it installs per-column renderers which in this setup can be done only
* after the columns are created.
*/
private void installRenderers() {
initStringRepresentation();
StringValue sv = stringValues.get("name");
table.setDefaultRenderer(Contributor.class, new DefaultTableRenderer(sv));
list.setCellRenderer(new DefaultListRenderer(sv));
tree.setCellRenderer(new DefaultTreeRenderer(sv));
treeTable.setTreeCellRenderer(new DefaultTreeRenderer(sv));
for (int i = 1; i < keys.length; i++) {
installColumnRenderers(i, new DefaultTableRenderer(stringValues.get(keys[i])));
}
// <snip> Unrelated, just for fun: Hyperlink
// Use a hyperlinkRenderer for the email column
HyperlinkProvider provider = new HyperlinkProvider(new ContributorMailAction(
stringValues.get("email")));
installColumnRenderers(keys.length - 1, new DefaultTableRenderer(provider));
table.getColumnExt(keys.length - 1).setToolTipText(
"Note: the mail-to action will do nothing in security restricted environments");
// </snip>
table.packAll();
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:28,代码来源:HighlighterExtDemo.java
示例10: installRenderers
import org.jdesktop.swingx.renderer.DefaultTableRenderer; //导入依赖的package包/类
/**
* Install renderers which use the prepared string representations.
* Note: this method is called after the binding (aka: attach models)
* because it installs per-column renderers which in this setup can be done only
* after the columns are created.
*/
// <snip> Custom String Representation
// install SwingX renderers configured with the appropriate String converter
private void installRenderers() {
StringValue sv = stringValues.get("name");
table.setDefaultRenderer(Contributor.class, new DefaultTableRenderer(sv));
list.setCellRenderer(new DefaultListRenderer(sv));
tree.setCellRenderer(new DefaultTreeRenderer(sv));
treeTable.setTreeCellRenderer(new DefaultTreeRenderer(sv));
for (int i = 1; i < keys.length; i++) {
installColumnRenderers(i, new DefaultTableRenderer(stringValues.get(keys[i])));
}
// </snip>
// PENDING JW: make the email column use a hyperlinkRenderer once the
// MatchingTextHighlighter can handle buttons
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:23,代码来源:SearchDemo.java
示例11: configureTableColumn
import org.jdesktop.swingx.renderer.DefaultTableRenderer; //导入依赖的package包/类
/**
* {@inheritDoc} <p>
*
* Overridden to set the column's identifier, lookup the title
*/
@Override
public void configureTableColumn(TableModel model,
TableColumnExt columnExt) {
super.configureTableColumn(model, columnExt);
columnExt.setIdentifier(model.getColumnName(columnExt.getModelIndex()));
configureTitle(columnExt);
ComponentProvider<?> provider = getComponentProvider(columnExt.getIdentifier());
if (provider != null) {
columnExt.setCellRenderer(new DefaultTableRenderer(provider));
}
Highlighter highlighter = getHighlighter(columnExt.getIdentifier());
if (highlighter != null) {
columnExt.setHighlighters(highlighter);
}
columnExt.setComparator(getComparator(columnExt.getIdentifier()));
columnExt.setPrototypeValue(getPrototypeValue(columnExt.getIdentifier()));
if (getHiddenNames().contains(columnExt.getIdentifier())) {
columnExt.setVisible(false);
}
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:26,代码来源:CustomColumnFactory.java
示例12: PluginInformationPane
import org.jdesktop.swingx.renderer.DefaultTableRenderer; //导入依赖的package包/类
public PluginInformationPane() {
super();
this.updateModel();
this.setViewportView(this.pluginsTreeTable);
this.pluginsTreeTable.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
this.pluginsTreeTable.getColumnExt(PluginInformationPane.ENABLED_INDEX).setCellEditor(
new BooleanCellEditor()
);
this.pluginsTreeTable.getColumnExt(PluginInformationPane.DOWNLOAD_INDEX).setCellRenderer(
new DefaultTableRenderer(new PluginActionProvider())
);
this.pluginsTreeTable.addHighlighter(new PluginInformationHighlighter());
this.pluginsTreeTable.addMouseListener(new MouseAdapter() {
/* (non-Javadoc)
* @see java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent)
*/
@Override
public void mouseClicked(MouseEvent e) {
PluginInformationPane.this.pluginsTreeTableMouseClicked(e);
}
});
}
开发者ID:sing-group,项目名称:aibench-project,代码行数:26,代码来源:PluginInformationPane.java
示例13: RepositoryInformationPane
import org.jdesktop.swingx.renderer.DefaultTableRenderer; //导入依赖的package包/类
public RepositoryInformationPane() throws NotInitializedException {
super();
this.setViewportView(this.pluginsTreeTable);
this.updateModel();
this.pluginsTreeTable.getColumnExt(RepositoryInformationPane.DOWNLOAD_INDEX).setCellRenderer(
new DefaultTableRenderer(new PluginActionProvider())
);
this.pluginsTreeTable.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
this.pluginsTreeTable.addHighlighter(new RepositoryHighlighter());
this.pluginsTreeTable.addMouseListener(new MouseAdapter() {
/* (non-Javadoc)
* @see java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent)
*/
@Override
public void mouseClicked(MouseEvent e) {
RepositoryInformationPane.this.pluginsTreeTableMouseClicked(e);
}
});
}
开发者ID:sing-group,项目名称:aibench-project,代码行数:22,代码来源:RepositoryInformationPane.java
示例14: configureTableColumn
import org.jdesktop.swingx.renderer.DefaultTableRenderer; //导入依赖的package包/类
/**
* {@inheritDoc}
* <p>
*
* Overridden to set the column's identifier, lookup the title
*/
@Override
public void configureTableColumn(TableModel model, TableColumnExt columnExt) {
super.configureTableColumn(model, columnExt);
columnExt.setIdentifier(model.getColumnName(columnExt.getModelIndex()));
configureTitle(columnExt);
ComponentProvider<?> provider = getComponentProvider(columnExt.getIdentifier());
if (provider != null) {
columnExt.setCellRenderer(new DefaultTableRenderer(provider));
}
Highlighter highlighter = getHighlighter(columnExt.getIdentifier());
if (highlighter != null) {
columnExt.setHighlighters(highlighter);
}
columnExt.setComparator(getComparator(columnExt.getIdentifier()));
columnExt.setPrototypeValue(getPrototypeValue(columnExt.getIdentifier()));
if (getHiddenNames().contains(columnExt.getIdentifier())) {
columnExt.setVisible(false);
}
}
开发者ID:gigony,项目名称:GUITester-core,代码行数:26,代码来源:CustomColumnFactory.java
示例15: createDefaultRenderers
import org.jdesktop.swingx.renderer.DefaultTableRenderer; //导入依赖的package包/类
/**
* Creates default cell renderers for <code>Object</code>s,
* <code>Number</code>s, <code>Date</code>s, <code>Boolean</code>s,
* <code>Icon/Image/</code>s and <code>URI</code>s.
* <p>
* Overridden to replace all super default renderers with SwingX variants and
* additionally register a default for <code>URI</code> types. Note: the latter
* registration will fail silently in headless environments or when the runtime
* context doesn't support Desktop.
*
* <p>
* {@inheritDoc}
*
* @see org.jdesktop.swingx.renderer.DefaultTableRenderer
* @see org.jdesktop.swingx.renderer.ComponentProvider
*/
@Override
protected void createDefaultRenderers() {
defaultRenderersByColumnClass = new UIDefaults(8, 0.75f);
// configured default table renderer (internally LabelProvider)
setDefaultRenderer(Object.class, new DefaultTableRenderer());
setDefaultRenderer(Number.class, new DefaultTableRenderer(
StringValues.NUMBER_TO_STRING, JLabel.RIGHT));
setDefaultRenderer(Date.class, new DefaultTableRenderer(
StringValues.DATE_TO_STRING));
// use the same center aligned default for Image/Icon
TableCellRenderer renderer = new DefaultTableRenderer(new MappedValue(
StringValues.EMPTY, IconValues.ICON), JLabel.CENTER);
setDefaultRenderer(Icon.class, renderer);
setDefaultRenderer(ImageIcon.class, renderer);
// use a ButtonProvider for booleans
setDefaultRenderer(Boolean.class, new DefaultTableRenderer(
new CheckBoxProvider()));
try {
setDefaultRenderer(URI.class, new DefaultTableRenderer(
new HyperlinkProvider(new HyperlinkAction())
));
} catch (Exception e) {
// nothing to do - either headless or Desktop not supported
}
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:43,代码来源:JXTable.java
示例16: testTableGetStringUsedInPatternFilter
import org.jdesktop.swingx.renderer.DefaultTableRenderer; //导入依赖的package包/类
/**
* Issue #1145-swingx: re-enable filtering with single-string-representation.
* was: Issue #767-swingx: consistent string representation.
*
* Here: test PatternFilter uses getStringXX
*/
@Test
public void testTableGetStringUsedInPatternFilter() {
JXTableT table = new JXTableT(new AncientSwingTeam());
table.setDefaultRenderer(Color.class, new DefaultTableRenderer(sv));
RowFilter<Object, Integer> filter = RowFilter.regexFilter("R/G/B: -2.*", 2);
table.setRowFilter(filter);
assertTrue(table.getRowCount() > 0);
assertEquals(sv.getString(table.getValueAt(0, 2)), table.getStringAt(0, 2));
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:16,代码来源:JXTableUnitTest.java
示例17: testStringValueRegistryFromColumnRendererChange
import org.jdesktop.swingx.renderer.DefaultTableRenderer; //导入依赖的package包/类
/**
* Issue 1145-swingx: re-enable filter to use string representation.
* Here: test that cell-location StringValue look up updates per-column renderer
* on setting on TableColumn.
*/
@Test
public void testStringValueRegistryFromColumnRendererChange() {
JXTable table = new JXTable(createModelDefaultColumnClasses(4));
int column = 2;
table.getColumn(column).setCellRenderer(new DefaultTableRenderer());
StringValueRegistry provider = table.getStringValueRegistry();
assertEquals(table.getCellRenderer(0, column), provider.getStringValue(0, column));
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:14,代码来源:JXTableUnitTest.java
示例18: testStringValueRegistryUpdated
import org.jdesktop.swingx.renderer.DefaultTableRenderer; //导入依赖的package包/类
/**
* Issue 1145-swingx: re-enable filter to use string representation.
* Here: test that default per-class string values are updated.
*/
@Test
public void testStringValueRegistryUpdated() {
table.setDefaultRenderer(Component.class, new DefaultTableRenderer());
assertEquals(table.getDefaultRenderer(Component.class),
table.getStringValueRegistry().getStringValue(Component.class));
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:11,代码来源:JXTableUnitTest.java
示例19: testCopyConstructor
import org.jdesktop.swingx.renderer.DefaultTableRenderer; //导入依赖的package包/类
/**
* Issue #822-swingx: replace cloneable by copy constructor.
* Here: test base properties copied.
*/
@Test
public void testCopyConstructor() {
TableColumnExt columnExt = new TableColumnExt(10, 200,
new DefaultTableRenderer(), new DefaultCellEditor(new JTextField(20)));
TableColumnExt copy = new TableColumnExt(columnExt);
assertEquals(columnExt.getModelIndex(), copy.getModelIndex());
assertEquals(columnExt.getWidth(), copy.getWidth());
assertEquals(columnExt.getCellRenderer(), copy.getCellRenderer());
assertEquals(columnExt.getCellEditor(), copy.getCellEditor());
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:15,代码来源:TableColumnExtTest.java
示例20: interactiveTableSortComparableAndStringValue
import org.jdesktop.swingx.renderer.DefaultTableRenderer; //导入依赖的package包/类
/**
* Issue #1156-swingx: sort must use comparable
*
* visually check that the custom string value for the color column is
* used for sorting.
*/
public void interactiveTableSortComparableAndStringValue() {
JXTable table = new JXTable(new AncientSwingTeam());
table.setDefaultRenderer(Color.class, new DefaultTableRenderer(sv));
JTable core = new JTable(table.getModel());
core.setAutoCreateRowSorter(true);
JXFrame frame = wrapWithScrollingInFrame(table, core, "JXTable <--> JTable: Compare sorting of color column");
show(frame);
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:17,代码来源:ComponentAdapterClientTest.java
注:本文中的org.jdesktop.swingx.renderer.DefaultTableRenderer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论