Topic: 请前辈评论applet编码风格,还能否优化

  Print this page

1.请前辈评论applet编码风格,还能否优化 Copy to clipboard
Posted by: jiayuewei
Posted on: 2007-08-11 15:13

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

public class Button extends JApplet {
private static final long serialVersionUID=123456L
  
  JButton b1 = new JButton("向左走");
  JButton b2 = new JButton("向右走");
  
  
public void init() {
   this.getContentPane();
   run(this);
   this.setVisible(true);
  }

  public void run(JApplet applet) {
  
   container();
   JFrame frame = new JFrame();
   frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
//响应关闭按钮

   }

  private void container() {
    Container cp = getContentPane();
    cp.setLayout(new FlowLayout());
    cp.add(b1);
    cp.add(b2);
  }
   }

2.Re:请前辈评论applet编码风格,还能否优化 [Re: jiayuewei] Copy to clipboard
Posted by: jiayuewei
Posted on: 2007-08-11 15:23

这段程序,在eclipse中运行正常,而在命令行中不报错,但也无显示,在ie中报 Button notinited 错误,请高手帮忙解决.......


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923