本文整理匯總了Java中org.jdesktop.swingx.JXTable.setBackground方法的典型用法代碼示例。如果您正苦於以下問題:Java JXTable.setBackground方法的具體用法?Java JXTable.setBackground怎麽用?Java JXTable.setBackground使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.jdesktop.swingx.JXTable
的用法示例。
在下文中一共展示了JXTable.setBackground方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: interactiveSimpleStriping
import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
* shows the effect of a simple striping highlighter on a
* colored table.
*
*/
public void interactiveSimpleStriping() {
JXTable table = new JXTable(tableModel);
table.setVisibleRowCount(table.getRowCount() + 3);
table.setBackground(new Color(0xC0FFC0));
table.addHighlighter(HighlighterFactory.createSimpleStriping());
Highlighter disabled = new AbstractHighlighter(HighlightPredicate.READ_ONLY) {
@Override
protected Component doHighlight(Component component,
ComponentAdapter adapter) {
component.setEnabled(false);
return component;
}
};
table.getColumnExt(0).setEditable(false);
table.getColumnExt(2).setEditable(false);
table.getColumnExt(0).setCellRenderer(new DefaultTableRenderer(new TextFieldProvider()));
table.addHighlighter(disabled);
showWithScrollingInFrame(table, "Simple gray striping");
}
示例2: interactiveSimpleStripingGroup
import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
* shows the effect of a simple striping highlighter on a
* colored table.
*
*/
public void interactiveSimpleStripingGroup() {
JXTable table = new JXTable(tableModel);
table.setVisibleRowCount(table.getRowCount() + 3);
table.setBackground(Color.YELLOW);
table.addHighlighter(HighlighterFactory.createSimpleStriping(Color.LIGHT_GRAY, 3));
showWithScrollingInFrame(table, "Simple gray striping, grouped by 3");
}
示例3: interactiveAlternateStriping
import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
* shows the effect of a simple striping highlighter on a
* colored table.
*
*/
public void interactiveAlternateStriping() {
JXTable table = new JXTable(tableModel);
table.setVisibleRowCount(table.getRowCount() + 3);
table.setBackground(Color.YELLOW);
table.addHighlighter(HighlighterFactory.createAlternateStriping(Color.WHITE, Color.LIGHT_GRAY));
showWithScrollingInFrame(table, "Alternate white/gray striping");
}
示例4: interactiveAlternateStripingGroup
import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
* shows the effect of a simple striping highlighter on a
* colored table.
*
*/
public void interactiveAlternateStripingGroup() {
JXTable table = new JXTable(tableModel);
table.setVisibleRowCount(table.getRowCount() + 3);
table.setBackground(Color.YELLOW);
table.addHighlighter(HighlighterFactory.createAlternateStriping(Color.WHITE, Color.LIGHT_GRAY, 3));
showWithScrollingInFrame(table, "Alternate white/gray striping");
}
示例5: interactiveCheckBoxAlpha
import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
* Issue ??-swingx: Boolean renderer background is slightly darker if
* background color is part-transparent.
*
*/
public void interactiveCheckBoxAlpha() {
JXTable table = new JXTable(new org.jdesktop.test.AncientSwingTeam());
table.setBackground(PaintUtils.setAlpha(Color.YELLOW, 100));
table.setOpaque(false);
table.addHighlighter(new RowHighlighter(new HighlightPredicate() {
public boolean isHighlighted(Component renderer, ComponentAdapter adapter) {
return ((Boolean) adapter.getValue(4)).booleanValue();
}
}));
showWithScrollingInFrame(table, "boolean renderer and alpha background");
}
示例6: interactiveValueBasedGradientHighlight
import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
* Use transparent gradient painter for value-based background highlighting
* with SwingX extended default renderer. Shared by table and list with
* background color.
*/
public void interactiveValueBasedGradientHighlight() {
TableModel model = new AncientSwingTeam();
JXTable table = new JXTable(model);
table.setBackground(HighlighterFactory.LEDGER);
ComponentProvider<JLabel> controller = new LabelProvider(
JLabel.RIGHT);
// table.setDefaultRenderer(Number.class, new DefaultTableRenderer(
// controller));
RelativePainterHighlighter gradientHighlighter =
createRelativeGradientHighlighter(HorizontalAlignment.RIGHT, 100);
table.addHighlighter(gradientHighlighter);
// re-use component controller and highlighter in a JXList
JXList list = new JXList(createListNumberModel(), true);
list.setBackground(table.getBackground());
list.setCellRenderer(new DefaultListRenderer(controller));
list.addHighlighter(gradientHighlighter);
list.toggleSortOrder();
JXFrame frame = wrapWithScrollingInFrame(table, list,
"transparent value relative highlighting (with RelativePH)");
// addStatusMessage(frame,
// "uses the default painter-aware label in renderer");
// crude binding to play with options - the factory is incomplete...
// addStatusComponent(frame, createTransparencyToggle(gradientHighlighter));
show(frame);
}
示例7: interactiveUITableWithAlternateRow
import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
* UIHighlighter: check if highlighter is updated when toggling LF.
*/
public void interactiveUITableWithAlternateRow() {
JXTable table = new JXTable(10, 2);
table.setBackground(ledger);
table.setHighlighters(HighlighterFactory.createSimpleStriping());
JXTable nohighlight = new JXTable(10, 2);
nohighlight.setBackground(ledger);
showWithScrollingInFrame(table, nohighlight, "colored table with ui highlighter <--> without highlighter");
}