哪来那么多高手啊,都睡觉去吧。嘿嘿,这个偶也不会啊。

解决方案 »

  1.   

    /*
     * Created on 2004-8-2
     *
     * To change the template for this generated file go to
     * Window>Preferences>Java>Code Generation>Code and Comments
     *//**
     * @author 崔占民
     *
     * To change the template for this generated type comment go to
     * Window>Preferences>Java>Code Generation>Code and Comments
     */
    package HelloApplet;
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    import java.awt.Graphics;
    import java.net.*;public class HelloApplet extends Applet implements ActionListener
    {
    public void init ()
    {
    GridLayout layout = new GridLayout (3, 4, 15, 5);
    setLayout (layout);
    Font font = new Font ("TimesRoman", Font.PLAIN, 24);
    setFont (font);
    Button button = new Button ("sun1");
    button.setActionCommand ("http://www.sum.com");
    button.addActionListener(this);
    add (button);

    button = new Button ("sun2");
    button.setActionCommand ("http://www.sum.com");
    button.addActionListener (this);
    add (button);

    button = new Button ("sun3");
    button.setActionCommand ("http://www.sum.com");
    button.addActionListener (this);
    add (button);

    button = new Button ("sun4");
    button.setActionCommand ("http://www.sum.com");
    button.addActionListener (this);
    add (button);

    button = new Button ("sun5");
    button.setActionCommand ("http://www.sum.com");
    button.addActionListener (this);
    add (button);

    button = new Button ("sun6");
    button.setActionCommand ("http://www.sum.com");
    button.addActionListener (this);
    add (button);

    button = new Button ("sun7");
    button.setActionCommand ("http://www.sum.com");
    button.addActionListener (this);
    add (button); button = new Button ("汉字");
    button.setActionCommand ("http://www.sum.com");
    button.addActionListener (this);
    add (button);
    }

    public void paint (Graphics g)
    {
    g.drawString ("Hello World!", 0, 50);
    }

    public void actionPerformed (ActionEvent event)
    {
    String pageName = event.getActionCommand ();

    try
    {
    URL url = new URL (pageName);
    AppletContext context = getAppletContext ();
    context.showDocument (url);
    }
    catch (MalformedURLException e)
    {
    repaint ();
    }
    }
    }
      

  2.   

    这是以前写的一个例子,可以实现你要的功能,不过里面有不少其他 的内容,主要的就那么两句,你看看吧,希望对你有帮助
      

  3.   

    怎么没人回答啊,全部在那儿up呢
    想学学都学不到……