please see the source bellow ,
i want "go button" open a frame and
"DOne button" on the frame open sun
for example.
but this source does not work .
import java.awt.*;
import java.util.*;
import java.applet.*;
import java.io.*;
import java.net.*;
public class one extends java.applet.Applet{
Button b1=new Button("go");
public void init(){
setLayout(null);
setSize(400,200);
add(b1);
b1.setBounds(250,10,100,30);
}
public boolean action(Event e,Object arg){
String s=(String )arg;
Graphics g = getGraphics();
if(e.target instanceof Button){
if(s.equals("go")){
F2 f2=new F2(1);
f2.resize(200,200);
f2.show();
}
}
return true;
}
}
class F2 extends Frame{
Button z=new Button("Done");
public F2(int c){
setBackground(Color.black);
setLayout(null);
z.setBounds(100,60,50,20);
add(z);
}
public boolean handleEvent(Event e){
if(e.id==Event.WINDOW_DESTROY)
dispose();
return super.handleEvent(e);
}
public boolean action(Event e,Object arg){
if(e.target instanceof Button){
GO i=new GO("http://java.sun.com");
}
return true;
}
}
class GO extends java.applet.Applet{
public GO(String str) {
try{
URL url = new URL("http://java.sun.com");
AppletContext context = getAppletContext();
context.showDocument(url);
}catch (MalformedURLException e1){
//System.out.println("h");
}
}
}