Preview.java 文件源码

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

项目:AtidDesktop 作者:
@Override
protected void paintComponent(Graphics g) {
    if (thumbnail == null) {
        loadImage();
    }
    if (thumbnail != null) {
        setBackground(Color.white);
        super.paintComponent(g);
        int x = getWidth() / 2 - thumbnail.getIconWidth() / 2;
        int y = getHeight() / 2 - thumbnail.getIconHeight() / 2;

        if (y < 0) {
            y = 0;
        }
        if (x < 0) {
            x = 0;
        }
        thumbnail.paintIcon(this, g, x, y);
    } else {
        setBackground(SystemColor.control);
        super.paintComponent(g);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号