JLabel 显示图片并自适应控件大小

    xiaoxiao2021-12-14  19

    static JLabel picture = new JLabel("New label"){ protected void paintComponent(Graphics g) { ImageIcon icon = new ImageIcon("C:\\Users\\Administrator\\Desktop\\1.jpg"); g.drawImage(icon.getImage(), 0, 0, getWidth(),getHeight(), icon.getImageObserver()); } };
    转载请注明原文地址: https://ju.6miu.com/read-969104.html

    最新回复(0)