本文整理汇总了Java中org.jdesktop.swingx.decorator.HighlightPredicate.ROLLOVER_ROW属性的典型用法代码示例。如果您正苦于以下问题:Java HighlightPredicate.ROLLOVER_ROW属性的具体用法?Java HighlightPredicate.ROLLOVER_ROW怎么用?Java HighlightPredicate.ROLLOVER_ROW使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.jdesktop.swingx.decorator.HighlightPredicate
的用法示例。
在下文中一共展示了HighlightPredicate.ROLLOVER_ROW属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: interactiveRolloverHighlight
/**
* Plain RolloverHighlighter.
* Issue #513-swingx: no rollover effect for disabled table.
*
*/
public void interactiveRolloverHighlight() {
final JXTable table = new JXTable(tableModel);
ColorHighlighter colorHighlighter = new ColorHighlighter(HighlightPredicate.ROLLOVER_ROW, Color.YELLOW, null);
table.addHighlighter(colorHighlighter);
Action action = new AbstractAction("toggle table enabled") {
@Override
public void actionPerformed(ActionEvent e) {
table.setEnabled(!table.isEnabled());
}
};
JXFrame frame = showWithScrollingInFrame(table, "rollover highlight, enabled/disabled table");
addAction(frame, action);
frame.pack();
}
示例2: setUp
@Override
protected void setUp() throws Exception {
super.setUp();
sortableTableModel = new AncientSwingTeam();
listModel = new AbstractListModel() {
public int getSize() {
return sortableTableModel.getRowCount();
}
public Object getElementAt(int index) {
return sortableTableModel.getValueAt(index, 0);
}
};
treeTableModel = new FileSystemModel();
foregroundHighlighter = new ColorHighlighter(HighlightPredicate.ROLLOVER_ROW, null,
Color.MAGENTA);
backgroundHighlighter = new ColorHighlighter(HighlightPredicate.ROLLOVER_ROW, Color.YELLOW,
null);
}
示例3: interactiveHierarchicalToolTip
/**
* Issue #??-swingx: Tooltip by highlighter in hierarchical column
*
* Issue #1527-swingx: tooltip not shown after changing expansion state.
*
* Not reliably updated (independent on whether to use a Highlighter or core renderer
* with Highlighter set, also @see {@link #interactiveTestToolTipsCoreRenderer()}
*
* To reproduce:
* - move to some row over the hierarchical column where the tooltip is showing
* - move the next row, typically the tooltip is not showing (no, can't reproduce)
* - reproducible (from bug report): collapse/expand the row, then move (in same or
* other row): tooltip not shown until the mouse has been moved completely outside
* of the table
*
* Seems to happen, if the tooltip was hidden due to the collapse/expose. To reproduce
* - move to show the tooltip in hierarchical column
* - wait until it is hidden by the tooltipManager
* - collapse/expand and move: tooltip shown again
*
*/
public void interactiveHierarchicalToolTip() {
ToolTipManager manager = ToolTipManager.sharedInstance();
final JXTreeTable table = new JXTreeTable(treeTableModel);
Highlighter toolTip = new AbstractHighlighter(
new AndHighlightPredicate(
new ColumnHighlightPredicate(0), HighlightPredicate.ROLLOVER_ROW)) {
@Override
protected Component doHighlight(Component component,
ComponentAdapter adapter) {
((JComponent) component).setToolTipText(adapter.getString());
return component;
}
};
table.addHighlighter(toolTip);
JXFrame frame = wrapWithScrollingInFrame(table, "ToolTip with Highlighter (hierarchical column)");
addComponentOrientationToggle(frame);
addStatusComponent(frame, new JTextField("something to focus"));
frame.setVisible(true);
}
示例4: createHighlighters
/**
* create all highlighters.
*
*
*/
private void createHighlighters() {
// <snip>rollover effect - light gray background
rolloverHighlighter = new ColorHighlighter(HighlightPredicate.ROLLOVER_ROW,
Color.LIGHT_GRAY, null
);
// </snip>
matchHighlighter = new ColorHighlighter(HighlightPredicate.NEVER,
null, Color.MAGENTA
);
// hacking a right/left margin
marginHighlighter = new BorderHighlighter(marginBorder);
// compoundHighlighter to share between table and tree
tableHighlighters = new CompoundHighlighter();
listHighlighters = new CompoundHighlighter();
}
示例5: interactiveBorderHighlighterOnRollover
/**
* Issue #1295-swingx: JXTable rolloverController repaint incomplete.
* Column not repainted.
*/
public void interactiveBorderHighlighterOnRollover() {
JXTable table = new JXTable(tableModel) {
int count;
@Override
protected void paintComponent(Graphics g) {
// crude check if the logic of column/row painting
// in TableRolloverController is working (looks so)
// LOG.info("paint clip: " + count++ + g.getClip());
super.paintComponent(g);
}
};
final AbstractHighlighter hlRow = new BorderHighlighter(HighlightPredicate.ROLLOVER_ROW,
// BorderFactory.createCompoundBorder(
new MatteBorder(1, 0, 1, 0, Color.lightGray)
// , BorderFactory.createEmptyBorder(0, 1, 0, 1))
, true, false );
final AbstractHighlighter hlColumn = new ColorHighlighter(HighlightPredicate.ROLLOVER_COLUMN,
Color.LIGHT_GRAY, null);
table.setHighlighters(hlRow, hlColumn);
JXFrame frame = wrapWithScrollingInFrame(table, "borderHighlgihter on rollover");
Action toggleCell = new AbstractAction("toggle cell-rollover") {
@Override
public void actionPerformed(ActionEvent e) {
if (hlRow.getHighlightPredicate() == HighlightPredicate.ROLLOVER_ROW) {
hlRow.setHighlightPredicate(HighlightPredicate.NEVER);
hlColumn.setHighlightPredicate(HighlightPredicate.ROLLOVER_CELL);
} else {
hlRow.setHighlightPredicate(HighlightPredicate.ROLLOVER_ROW);
hlColumn.setHighlightPredicate(HighlightPredicate.ROLLOVER_COLUMN);
}
}
};
addAction(frame, toggleCell);
show(frame);
}
示例6: interactiveTreeFancyButton
/**
* PENDING JW: really fancify or remove ;-)
*/
public void interactiveTreeFancyButton() {
JXTree tree = new JXTree();
tree.setRowHeight(30);
MattePainter painter = new MattePainter(Color.YELLOW);
Highlighter hl = new PainterHighlighter(HighlightPredicate.ROLLOVER_ROW, painter);
tree.addHighlighter(hl);
ComponentProvider<?> provider = new NormalButtonProvider(StringValues.TO_STRING, JLabel.LEADING);
tree.setCellRenderer(new DefaultTreeRenderer(provider));
tree.setRolloverEnabled(true);
showWithScrollingInFrame(tree, "Fancy..");
}
示例7: interactiveRolloverPainter
/**
* Use Painter for an underline-rollover effect.
*/
public void interactiveRolloverPainter() {
TableModel model = new AncientSwingTeam();
JXTable table = new JXTable(model);
MattePainter matte = new MattePainter(getTransparentColor(Color.RED, 80));
RelativePainter<?> painter = new RelativePainter<Object>(matte);
painter.setYFactor(0.2);
painter.setVerticalAlignment(VerticalAlignment.BOTTOM);
Highlighter hl = new PainterHighlighter(HighlightPredicate.ROLLOVER_ROW, painter);
table.addHighlighter(hl);
JXFrame frame = wrapWithScrollingInFrame(table,
"painter-aware renderer rollover");
addStatusComponent(frame, new JLabel("gradient background of cells with value's containing 'y'"));
show(frame);
}
示例8: createRolloverHighlighter
private Highlighter createRolloverHighlighter(boolean useForeground) {
Color color = new Color(0xF0, 0xF0, 0xE0); //LegacyHighlighter.ledgerBackground.getBackground();
Highlighter highlighter = new ColorHighlighter(
HighlightPredicate.ROLLOVER_ROW, useForeground ? null : color,
useForeground ? color.darker() : null);
return highlighter;
}
示例9: interactiveTreeTableRolloverHierarchical
/**
* Example for per-cell rollover decoration in JXTreeTable.
*/
public void interactiveTreeTableRolloverHierarchical() {
final JXTreeTable table = new JXTreeTable(treeTableModel);
HighlightPredicate andPredicate = new AndHighlightPredicate(
new HighlightPredicate.ColumnHighlightPredicate(0),
HighlightPredicate.ROLLOVER_ROW
);
final Highlighter foregroundHighlighter = new ColorHighlighter(andPredicate, null,
Color.MAGENTA);
final Highlighter backgroundHighlighter = new ColorHighlighter(andPredicate, Color.YELLOW,
null);
table.setHighlighters(foregroundHighlighter);
JXFrame frame = wrapWithScrollingInFrame(table, "TreeTable with rollover - effect hierarchical column");
Action toggleAction = new AbstractAction("toggle foreground/background") {
boolean isBackground;
public void actionPerformed(ActionEvent e) {
if (isBackground) {
table.setHighlighters(foregroundHighlighter);
} else {
table.setHighlighters(backgroundHighlighter);
}
isBackground = !isBackground;
}
};
addAction(frame, toggleAction);
frame.setVisible(true);
}
示例10: interactiveTestRolloverHighlight
/**
* Plain rollover highlight, had been repaint issues.
*
*/
public void interactiveTestRolloverHighlight() {
JXList list = new JXList(listModel);
list.setRolloverEnabled(true);
ColorHighlighter rollover = new ColorHighlighter(HighlightPredicate.ROLLOVER_ROW, new Color(0xF0, 0xF0, 0xE0),
null);
list.addHighlighter(rollover);
showWithScrollingInFrame(list, "rollover highlight");
}