import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import javax.swing.JOptionPane;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseEvent;
public class mitesh extends Applet implements ActionListener
{
// image viewer
Image mycard;
Button myButton=new Button("Show Pictures 1,2,3,4,5,6 or 7");
TextField myTextField=new TextField("1");
static int choice=0;
Button b;
Button c;
public void init()
{
b = new Button("thankyou");
add(b);
b.addActionListener(this);
c = new Button("presented by");
add(c);
c.addActionListener(this);
// image source code
add(myButton);
add(myTextField);
myButton.addActionListener(this);
}
public void actionPerformed(ActionEvent event)
{
if (event.getActionCommand()== "thankyou")
{
JOptionPane.showMessageDialog(null, "Thank you for supporting");
}
if (event.getActionCommand()== "presented by")
{
JOptionPane.showMessageDialog(null, " Justfreeknowledge By Mitesh Patel ");
}
// image viewer source code
String temp;
Object source=event.getSource();
if(source.equals(myButton))
{
temp=myTextField.getText().trim(); //trim off spaces in textfield
choice=Integer.parseInt(temp);
repaint();
System.out.println(choice);
}
}
public void paint(Graphics g)
{
resize(640,640);
System.out.println(choice);
if(choice ==1)
{
mycard=getImage(getCodeBase(), "1.jpg");
g.drawImage(mycard, 250,100, this);
}
if(choice ==2)
{
mycard=getImage(getCodeBase(), "2.jpg");
g.drawImage(mycard, 200,100, this);
}
if(choice ==3)
{
mycard=getImage(getCodeBase(), "3.jpg");
g.drawImage(mycard, 200,100, this);
}
if(choice ==4)
{
mycard=getImage(getCodeBase(), "4.jpg");
g.drawImage(mycard, 200,100, this);
}
if(choice ==5)
{
mycard=getImage(getCodeBase(), "5.jpg");
g.drawImage(mycard, 200,100, this);
}
if(choice ==6)
{
mycard=getImage(getCodeBase(), "6.jpg");
g.drawImage(mycard, 200,100, this);
}
if(choice ==7)
{
mycard=getImage(getCodeBase(), "7.jpg");
g.drawImage(mycard, 200,100, this);
}
}
}
import java.awt.event.*;
import java.applet.*;
import javax.swing.JOptionPane;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseEvent;
public class mitesh extends Applet implements ActionListener
{
// image viewer
Image mycard;
Button myButton=new Button("Show Pictures 1,2,3,4,5,6 or 7");
TextField myTextField=new TextField("1");
static int choice=0;
Button b;
Button c;
public void init()
{
b = new Button("thankyou");
add(b);
b.addActionListener(this);
c = new Button("presented by");
add(c);
c.addActionListener(this);
// image source code
add(myButton);
add(myTextField);
myButton.addActionListener(this);
}
public void actionPerformed(ActionEvent event)
{
if (event.getActionCommand()== "thankyou")
{
JOptionPane.showMessageDialog(null, "Thank you for supporting");
}
if (event.getActionCommand()== "presented by")
{
JOptionPane.showMessageDialog(null, " Justfreeknowledge By Mitesh Patel ");
}
// image viewer source code
String temp;
Object source=event.getSource();
if(source.equals(myButton))
{
temp=myTextField.getText().trim(); //trim off spaces in textfield
choice=Integer.parseInt(temp);
repaint();
System.out.println(choice);
}
}
public void paint(Graphics g)
{
resize(640,640);
System.out.println(choice);
if(choice ==1)
{
mycard=getImage(getCodeBase(), "1.jpg");
g.drawImage(mycard, 250,100, this);
}
if(choice ==2)
{
mycard=getImage(getCodeBase(), "2.jpg");
g.drawImage(mycard, 200,100, this);
}
if(choice ==3)
{
mycard=getImage(getCodeBase(), "3.jpg");
g.drawImage(mycard, 200,100, this);
}
if(choice ==4)
{
mycard=getImage(getCodeBase(), "4.jpg");
g.drawImage(mycard, 200,100, this);
}
if(choice ==5)
{
mycard=getImage(getCodeBase(), "5.jpg");
g.drawImage(mycard, 200,100, this);
}
if(choice ==6)
{
mycard=getImage(getCodeBase(), "6.jpg");
g.drawImage(mycard, 200,100, this);
}
if(choice ==7)
{
mycard=getImage(getCodeBase(), "7.jpg");
g.drawImage(mycard, 200,100, this);
}
}
}