为什么不出现界面

superlink 2001-02-20 05:53:00
我在jbulider 下运行下面的程序,
package ImageLabel;

import java.applet.*;
import java.awt.*;
import javax.swing.*;

public class ImageLabelApplet extends JApplet
{
public void init()
{
Image image = getImage(getCodeBase(),"dog.gif");
ImageIcon icon = new ImageIcon(image);
JButton button = new JButton(icon);
Image rollImage = getImage(getCodeBase(),"dog-roll.gif");
ImageIcon rollIcon = new ImageIcon(rollImage);
button.setRolloverIcon (rollIcon);
Image pressImage = getImage(getCodeBase(),"dog-press.gif");
ImageIcon pressIcon = new ImageIcon(pressImage);
button.setPressedIcon (pressIcon);
getContentPane().setLayout (new FlowLayout());
getContentPane().add (button,BorderLayout.NORTH );
}

}
为什么没有出现运行的界面,也就是图片及容纳他的界面
...全文
135 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
superlink 2001-02-22
  • 打赏
  • 举报
回复
好像不对
CoffeeBeans 2001-02-22
  • 打赏
  • 举报
回复
java.lang.NoSuchMethodError: main
Exception in thread "main"
-----this is your program error.
it should just like this :
public class ImageLabelApplet extends JApplet
implements runnable{
......
}



CoffeeBeans 2001-02-20
  • 打赏
  • 举报
回复
在下愚见:
applet 没调用public static void start()。
不知对不对。
NEOS 2001-02-20
  • 打赏
  • 举报
回复
你可以设置背景颜色为别的颜色,如果没有变化则可以肯定是layout的问题

hello_wyq 2001-02-20
  • 打赏
  • 举报
回复
是不是你的的程序有问题?
getContentPane().add(button);

604

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 控件与界面
社区管理员
  • 控件与界面社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧