java 图标 无法运行?

来源:百度知道 编辑:UC知道 时间:2024/06/08 02:06:06
import Java.awt.BorderLayout
import java.awt.Color.*;

import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.ImageIcon;
import javax.swing.JPanel;

public class Icon exetends JFrame{

private JLable jLabel=null;
private JPanel jContentPane=null;

/**
* @param args
*/
public void IconForme() {
super();
finalize();

private void initilize(){
this.setSize=(400,400);
this.setLocation(50,150);
this.setBackground(Color.WHITE);
this.setContentPane(getJContentPane());
this.setTitle("Help");

private JPanel getContentPane(){
if(jContentPane==null){
jLabel=new JLabel();
jLabel.setText("图书管理系统");
jLabel.setIcon(new ImageIcon(getClass()getResource("/gif_welcome13[1].gif")));

jContentPane=new JPanel();

jLabel.setIcon(new ImageIcon(getClass()getResource("/gif_welcome13[1].gif")));
getClass()后面缺了一个符号. ,是不是贴代码时漏了?如果不是清说清楚,什么情况?是出现了错误,还是图片没有显示?
如果图片没有显示,请确认gif_welcome13[1].gif文件是不是在类路径内。如果在类路径内,那么把前面的/去掉看看