看一下这段代码为什么显示不出来JLabel的图片:importjava.awt.Container;importjavax.swing.ImageIcon;importjavax.swing.JFrame;importjavax.swing.JLabel;importjavax.swing.UIMan...
看一下这段代码为什么显示不出来JLabel的图片:
import java.awt.Container;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.UIManager;
import com.zxh.util.GuiTool;
public class Start extends JFrame{
public static void main(String[] args) throws Exception {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
new Start().init();
}
private void init(){
this.setTitle("ChanelHong1.0");
//GuiTool.windowz(this,700,500,"/03.jpg",true);
this.setResizable(false);
ImageIcon image=new ImageIcon("123.jpg");
JLabel welcome=new JLabel(image);
welcome.setSize(300,450);
Container con=this.getContentPane();
this.add(welcome);
this.setSize(700,500);
this.setVisible(true);
}
}
应该说各位运行这段代码都能够显示出图片来,但我的就是不显示,不知道eclipse到底在发什么疯?
展开