当前位置: 技术问答>java相关
请问如何将一个图片作为一个panel的背景,需源代码。谢谢!
来源: 互联网 发布时间:2015-01-29
本文导语: 我是新手,请给出源代码~~ | import javax.swing.*; import java.awt.*; class ImgPane extends JPanel { private ImageIcon picture = new ImageIcon("your.gif"); private int picturew = picture.getIconWidth(); private int pictur...
我是新手,请给出源代码~~
|
import javax.swing.*;
import java.awt.*;
class ImgPane extends JPanel {
private ImageIcon picture = new ImageIcon("your.gif");
private int picturew = picture.getIconWidth();
private int pictureh = picture.getIconHeight();
public void paintComponent(Graphics g) {
Dimension size = getSize();
for(int row=0; row
import java.awt.*;
class ImgPane extends JPanel {
private ImageIcon picture = new ImageIcon("your.gif");
private int picturew = picture.getIconWidth();
private int pictureh = picture.getIconHeight();
public void paintComponent(Graphics g) {
Dimension size = getSize();
for(int row=0; row