|
import java.applet.*;
import java.awt.*;
import javax.swing.*;
public class useImage extends JApplet
{
Image imagel1;
public void init()
{
JPanel panel1=(JPanel)getContentPane();
panel1.setLayout(new BorderLayout());
imagel1=getImage(getCodeBase(),"cnncterr.jpg");
ImageIcon icon=new ImageIcon(imagel1);
JLabel imagelabel=new JLabel("我是york",icon);
panel1.add(imagelabel);
}
}
编译时提示:
I:\JAVA>javac useImage.java
useImage.java:18: cannot resolve symbol
symbol : constructor JLabel (java.lang.String,javax.swing.ImageIcon)
location: class javax.swing.JLabel
JLabel imagelabel=new JLabel("我是york",icon);
^
1 error
JLabel imagelabel=new JLabel("我是york",icon);
这里有问题?,第一个参数是是一个STRING啊 |
|