ColorSwatch.java 文件源码

java
阅读 19 收藏 0 点赞 0 评论 0

项目:pumpernickel 作者:
@Override
public void paint(Graphics g0) {
    super.paint(g0); //may be necessary for some look-and-feels?

    Graphics2D g = (Graphics2D)g0;

    Color c = getForeground();
    int w2 = Math.min(getWidth(), w);
    int h2 = Math.min(getHeight(), w);
    Rectangle r = new Rectangle(getWidth()/2-w2/2,getHeight()/2-h2/2, w2, h2);

    if(c.getAlpha()<255) {
        TexturePaint checkers = getCheckerPaint();
        g.setPaint(checkers);
        g.fillRect(r.x, r.y, r.width, r.height);
    }
    g.setColor(c);
    g.fillRect(r.x, r.y, r.width, r.height);
    PlafPaintUtils.drawBevel(g, r);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号