本文整理汇总了Java中org.jdesktop.swingx.painter.MattePainter.setFillPaint方法的典型用法代码示例。如果您正苦于以下问题:Java MattePainter.setFillPaint方法的具体用法?Java MattePainter.setFillPaint怎么用?Java MattePainter.setFillPaint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jdesktop.swingx.painter.MattePainter
的用法示例。
在下文中一共展示了MattePainter.setFillPaint方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testPainterHighlighterPainterPropertyChangeNotificatioon
import org.jdesktop.swingx.painter.MattePainter; //导入方法依赖的package包/类
/**
* Issue #851-swingx: Highlighter must notify on painter property change
*/
@Test
public void testPainterHighlighterPainterPropertyChangeNotificatioon() {
PainterHighlighter hl = new PainterHighlighter();
Color red = Color.RED;
MattePainter mattePainter = new MattePainter(red);
assertEquals(red, mattePainter.getFillPaint());
PropertyChangeReport p = new PropertyChangeReport();
mattePainter.addPropertyChangeListener(p);
hl.setPainter(mattePainter);
assertEquals(mattePainter, hl.getPainter());
ChangeReport report = new ChangeReport();
hl.addChangeListener(report);
mattePainter.setFillPaint(Color.BLUE);
assertEquals(p.getEventCount(), report.getEventCount());
}
示例2: interactivePainterUpdate
import org.jdesktop.swingx.painter.MattePainter; //导入方法依赖的package包/类
/**
* Issue #1199-swingx: JXPanel - must repaint on changes to background
* painter.
*/
public void interactivePainterUpdate() {
JXPanel panel = new JXPanel();
final MattePainter painter = new MattePainter(Color.RED);
panel.setBackgroundPainter(painter);
JXFrame frame = wrapInFrame(panel, "background");
Action toggleColor = new AbstractAction("toggle background") {
@Override
public void actionPerformed(ActionEvent e) {
Paint old = painter.getFillPaint();
painter.setFillPaint(old == Color.RED ? Color.YELLOW
: Color.RED);
}
};
addAction(frame, toggleColor);
show(frame, 200, 200);
}