【发布时间】:2012-05-15 21:22:45
【问题描述】:
好的,这是我的第一个小程序,我多次尝试绕过这个异常。 任何形式的帮助将不胜感激!谢谢!
这是我的代码:
package Application;
import java.applet.*;
import java.awt.*;
import javax.swing.JApplet;
import javax.swing.JButton;
import javax.swing.JPanel;
public class FirstApplet extends JApplet
{
private JPanel jpnlMain = new JPanel(new BorderLayout());
private JPanel jpnlBoutton = new JPanel(new GridLayout(5,5));
private JPanel jpnlLogo = new JSplash(this);
private GenericRoundedButton[] jbtnAllo = new GenericRoundedButton[10];
public void init(){
super.init();
this.add(jpnlMain);
for(int i =0;i<jbtnAllo.length;i++){
jbtnAllo[i] = new GenericRoundedButton();
jpnlBoutton.add(jbtnAllo[i]);
}
jpnlMain.add(jpnlBoutton,"North");
jpnlMain.add(jpnlLogo,"Center");
}
}
这是我的 HTML 代码:
<html>
<title>The ImageDemo applet</title>
<hr>
<applet code="Application.FirstApplet.class" width="400" height="400">
</applet>
<hr>
</html>
【问题讨论】:
-
JSplash 是一个扩展 JPanel 的类,并且只在几毫秒内显示一个图像 GenericRoundedButton 是一个重做按钮的类,以便它们具有圆形边缘。
-
1) 为了尽快获得更好的帮助,请发帖 SSCCE。 2) 复制/粘贴异常文本,以便我们查看是哪一行导致它。
-
“这是我的第一个小程序” 为什么还要制作一个小程序?将 GUI 编码为框架并使用 Java Web Start 从链接启动它。
-
好吧,基本上,我做了一个 Applet,我们正在尝试为 Switch 创建一个用户界面,该用户界面可以从 Internet 访问,并且用户可以从端口控制交换机。感谢您的评论,我将检查 Java Web 开始!看起来它可能真的很有用!