Java Code Examples for org.jdesktop.swingx.painter.Painter

The following examples show how to use org.jdesktop.swingx.painter.Painter. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
public SpotCellRenderer() {
    dummyThn = new ImageIcon(new BufferedImage(thumbnailWidth, thumbnailHeight, BufferedImage.TYPE_INT_RGB));
    dummyThn.getImage().getGraphics().setColor(Color.white);
    dummyThn.getImage().getGraphics().fillRect(0, 0, dummyThn.getIconWidth(), dummyThn.getIconHeight());

    jxlab.setBackgroundPainter((Painter<JXLabelExt>) (g2d, label, width, height) -> {
        if (label.isProposed)
            g2d.setPaint(new GradientPaint(0, 0, label.getBackground(), label.getWidth(), label.getHeight(), Color.white));
        else g2d.setPaint(label.getBackground());
        g2d.fillRect(0, 0, label.getWidth(), label.getHeight());
    });

}
 
Example 2
Source Project: BART   Source File: RelativePainterHighlighter.java    License: MIT License 5 votes vote down vote up
/** 
 * Overridden to wrap a RelativePainter around the given, if not already is 
 * of type RelativePainter. 
 */ 
// <snip> Relative Decorator 
// Wraps Painter into RelativePainter (hack around missing api in swingx) 
@Override 
public void setPainter(Painter painter) { 
    if (!(painter instanceof RelativePainter)) { 
        painter = new RelativePainter(painter); 
    } 
    super.setPainter(painter); 
}
 
Example 3
Source Project: BART   Source File: RelativePainterHighlighter.java    License: MIT License 5 votes vote down vote up
public void setPainter(Painter<? super T> painter) { 
    uninstallPainterListener(); 
    Object old = getPainter(); 
    this.painter = painter; 
    installPainterListener(); 
    firePropertyChange("painter", old, getPainter()); 
}
 
Example 4
Source Project: BART   Source File: RelativePainterHighlighter.java    License: MIT License 4 votes vote down vote up
public RelativePainterHighlighter(Painter delegate) { 
    super(delegate); 
}
 
Example 5
Source Project: BART   Source File: RelativePainterHighlighter.java    License: MIT License 4 votes vote down vote up
public RelativePainter(Painter<? super T> delegate) { 
    this.painter = delegate; 
    installPainterListener(); 
}
 
Example 6
Source Project: BART   Source File: RelativePainterHighlighter.java    License: MIT License 4 votes vote down vote up
public RelativePainter(Painter<? super T> delegate, double xPercent) { 
    this(delegate); 
    xFactor = xPercent; 
}
 
Example 7
Source Project: BART   Source File: RelativePainterHighlighter.java    License: MIT License 4 votes vote down vote up
public Painter<? super T> getPainter() { 
    return painter; 
}