當前位置:編程學習大全網 - 電腦編程 - java如何在已有的背景圖片上貼上其他圖片

java如何在已有的背景圖片上貼上其他圖片

妳的背景圖片可以在壹個jpanel上,圖片在jpane之上的jpane容器.別使用setcontentpane方法,使用.

public class WelcomePanel extends JPanel {

private ImageIcon welcomImageIcon = null;

public WelcomePanel(){

URL url = this.getClass().getResource("/images/welcome.jpg");

this.welcomImageIcon = new ImageIcon(url);

}

public void paintComponent(Graphics g) {

g.drawImage(this.welcomImageIcon.getImage(), 0, 0, this.getWidth(), this.getHeight(), this);

}

}

  • 上一篇:逗比的諧音網名 逗比的諧音網名精選
  • 下一篇:壹般來講,SMT貼片加工工廠需要具備什麽技術員工?
  • copyright 2024編程學習大全網