java界面背景图片显示不了,

[复制链接]
查看11 | 回复3 | 2013-6-4 15:39:01 | 显示全部楼层 |阅读模式
JPanel jPanelToolBar = new JPanel(new BorderLayout()){
public void paintComponent(Graphics g) {
super.paintComponent(g);
Image image = paintPicture("1_03");
if (image != null) {
int height = image.getHeight(this);
int width = image.getWidth(thi...
回复

使用道具 举报

千问 | 2013-6-4 15:39:01 | 显示全部楼层
this.setIconImage(image);这个是设置窗体上的logo图标啊 不是背景图片啊...
回复

使用道具 举报

千问 | 2013-6-4 15:39:01 | 显示全部楼层
重写JPanl面板中Paint方法,在这个方法中设置想要设置的图片,再new出这个JPanl并代替根面板。...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行