import java.applet.*;
/*
<applet code=”App.class” width=”200″ height=”200″>
</applet>
*/
public class App extends Applet{
public void start(){
System.out.println(“start()”);
}
public void init(){
System.out.println(“init()”);
}
public void stop(){
System.out.println(“stop()”);
}
public void paint(Graphics g){
System.out.println(“paint(Graphics)”);
}
public void destroy(){
System.out.println(“destroy()”);
}
}
//——————————————————————-
import java.applet.*;
import java.awt.*;
/*
<applet code=”App2.class” width=”200″ height=”200″>
</applet>
*/
public class App2 extends Applet{
public void start(){
System.out.println(“start()”);
}
public void init(){
System.out.println(“init()”);
}
public void stop(){
System.out.println(“stop()”);
}
public void paint(Graphics g){
System.out.println(“paint(Graphics)”);
}
public void destroy(){
//start();
System.out.println(“destroy()”);
}
}
//————————————————————————–
import java.applet.*;
import java.awt.*;
public class App3 extends Applet{
public void init(){
setBackground(Color.yellow);
setForeground(new Color(250,100,200));
}
public void paint(Graphics g){
g.drawString(“HELLO”,100,20);
g.setColor(Color.red);
g.setFont(new Font(“Comic sans ms”,Font.BOLD,40));
g.drawString(“HELLO”,100,50);
g.drawOval(20,20,100,100);//x,y,w,h
g.fillOval(30,40,10,10);
g.fillOval(60,40,10,10);
g.drawLine(60,80,90,80);
g.drawRect(60,120,90,50);
g.fillRect(60,150,40,40);
}
}
//———————————————————————
import java.applet.*;
import java.awt.*;
/*
<applet code=”App4.class” width=”500″ height=”500″>
</applet>
*/
public class App4 extends Applet{
public void init(){
setBackground(Color.yellow);
setForeground(new Color(250,100,200));
}
int i=1;
public void paint(Graphics g){
g.drawString(“HELLO”,100,20);
if(i%2==0)
g.setColor(Color.red);
else
g.setColor(Color.yellow);
g.setFont(new Font(“Comic sans ms”,Font.BOLD,40));
g.drawString(“HELLO”,100,50);
g.drawOval(20,20,100,100);//x,y,w,h
g.fillOval(30,40,10,10);
g.fillOval(60,40,10,10);
g.drawLine(60,80,90,80);
g.drawRect(60,120,90,50);
g.fillRect(60,150,40,40);
try{
Thread.sleep(200);
}catch(InterruptedException e){
}
i++;
repaint();
}
}
//——————————————————————
import java.applet.*;
import java.awt.*;
/*
<applet code=”App5.class” width=”500″ height=”500″></applet>
*/
public class App5 extends Applet{
public void init(){
setBackground(Color.yellow);
setForeground(new Color(250,100,200));
}
int x=20,t=1;
int f;
public void paint(Graphics g){
g.setColor(Color.red);
g.fillOval(x,20,50,50);
try{
Thread.sleep(10);
}catch(InterruptedException e){
}
if(x==450)
t=-1*t;
x=x+t;
if(x==20)
t=-1*t;
/*if(x==450){
f=1;
}
if(f==0)
x++;
else
x–;*/
repaint();
}
}
//——————————————————————
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
/*
<applet code=”App6.class” width=”500″ height=”200″></applet>
*/
public class App6 extends Applet implements MouseListener{
public void init(){
setBackground(Color.yellow);
addMouseListener(this);
}
public void mouseClicked(MouseEvent e){
System.out.println(“mouseClicked”);
}
public void mousePressed(MouseEvent e){
System.out.println(“mousePressed”);
}
public void mouseReleased(MouseEvent e){
System.out.println(“mouseReleased”);
}
public void mouseEntered(MouseEvent e){
System.out.println(“mouseEntered”);
}
public void mouseExited(MouseEvent e){
System.out.println(“mouseExited”);
}
}
//———————————————————————–
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
/*
<applet code=”App7.class” width=”500″ height=”200″></applet>
*/
public class App7 extends Applet implements MouseListener{
public void init(){
setBackground(Color.yellow);
addMouseListener(this);
}
public void mouseClicked(MouseEvent e){
System.out.println(“mouseClicked”);
}
public void mousePressed(MouseEvent e){
System.out.println(“mousePressed”);
//showStatus(“Pressed”);
showStatus(e.getX()+” , “+e.getY());
}
public void mouseReleased(MouseEvent e){
System.out.println(“mouseReleased”);
}
public void mouseEntered(MouseEvent e){
System.out.println(“mouseEntered”);
}
public void mouseExited(MouseEvent e){
System.out.println(“mouseExited”);
}
}
//——————————————————————
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
/*
<applet code=”App8.class” width=”500″ height=”200″></applet>
*/
public class App8 extends Applet implements MouseListener,MouseMotionListener{
public void init(){
setBackground(Color.yellow);
addMouseListener(this);
addMouseMotionListener(this);
}
public void mouseClicked(MouseEvent e){
System.out.println(“mouseClicked”);
}
public void mouseDragged(MouseEvent e){
System.out.println(“mouseDragged”);
}
public void mouseMoved(MouseEvent e){
System.out.println(“mouseMoved”);
showStatus(e.getX()+” , “+e.getY());
}
public void mousePressed(MouseEvent e){
System.out.println(“mousePressed”);
//showStatus(“Pressed”);
}
public void mouseReleased(MouseEvent e){
System.out.println(“mouseReleased”);
}
public void mouseEntered(MouseEvent e){
System.out.println(“mouseEntered”);
}
public void mouseExited(MouseEvent e){
System.out.println(“mouseExited”);
}
}
//———————————————————————
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
/*
<applet code=”App9.class” width=”500″ height=”200″></applet>
*/
public class App9 extends Applet implements MouseListener,MouseMotionListener{
int x=0,y=0;
public void paint(Graphics g){
g.fillOval(x,y,50,50);
}
public void init(){
setBackground(Color.yellow);
addMouseListener(this);
addMouseMotionListener(this);
}
public void mouseClicked(MouseEvent e){
System.out.println(“mouseClicked”);
x=e.getX();
y=e.getY();
repaint();
}
public void mouseDragged(MouseEvent e){
System.out.println(“mouseDragged”);
}
public void mouseMoved(MouseEvent e){
}
public void mousePressed(MouseEvent e){
System.out.println(“mousePressed”);
//showStatus(“Pressed”);
}
public void mouseReleased(MouseEvent e){
System.out.println(“mouseReleased”);
}
public void mouseEntered(MouseEvent e){
System.out.println(“mouseEntered”);
}
public void mouseExited(MouseEvent e){
System.out.println(“mouseExited”);
}
}