import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class test extends JApplet {
public void go() {
this.setSize(500,500);
this.setVisible(true);
this.setLayout(new FlowLayout());
System.out.println("in go");
JButton jb=new JButton("click me");
this.add(jb);
jb.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent ae)
{
JOptionPane.showMessageDialog(null,"japplet example");
}
}
);
}
public void init()
{
System.out.println("in init");
try{
SwingUtilities.invokeAndWait(new Runnable(){
public void run()
{
go();
}
});
}
catch(Exception e){
e.printStackTrace();
}
}
public void paint(Graphics g)
{
//g.drawString("hi shailesh",10,10);
}
}
import java.awt.*;
import java.awt.event.*;
public class test extends JApplet {
public void go() {
this.setSize(500,500);
this.setVisible(true);
this.setLayout(new FlowLayout());
System.out.println("in go");
JButton jb=new JButton("click me");
this.add(jb);
jb.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent ae)
{
JOptionPane.showMessageDialog(null,"japplet example");
}
}
);
}
public void init()
{
System.out.println("in init");
try{
SwingUtilities.invokeAndWait(new Runnable(){
public void run()
{
go();
}
});
}
catch(Exception e){
e.printStackTrace();
}
}
public void paint(Graphics g)
{
//g.drawString("hi shailesh",10,10);
}
}
No comments:
Post a Comment