ما ننسى تنظيم "; { } ( )" عشان بتجوط مرات
import java.awt.event.*;
import javax.swing.*;
import java.awt.*;
import java.lang.Object;
import java.io.*;
public class demo extends JFrame
{
public static int as=10;
public static demo x;
String name;
String coll;
int sum,count2,count3;
RandomAccessFile re,read,write,write1;
JFrame t12,g1;
JLabel statusBar;
public static UIManager.LookAndFeelInfo looks[];
boolean eas1,med1,ha1;
public static boolean en1=false,en2=false,en3=false;
public static boolean f12,f22,f3,fl=true,fl1=true,f13,f23,f33;
public static int t=1000,i=1,count=30;
public static int t1=1000,i1=1,i2=1,t2=1200;
public static int count1=30;
JRadioButton easy,hard,med;
ButtonGroup bu;
public static int g,r,b;
public static JPanel p,p1,p2,p3;
public static JFrame f,f1,f2,f4;
JButton b1,b2,b3,b4,click,click1,click2,click3,click4,click5,click6,lost,lost1,lost2;
public static JLabel l;
public static JLabel la,cl;
public demo(){super("sonic");
looks = UIManager.getInstalledLookAndFeels();
try {
UIManager.setLookAndFeel( looks[2].getClassName() );
}
catch ( Exception exception ) {
exception.printStackTrace();
}
f1=new JFrame("maoasaeed");
p1=new AboutPanel1();
p1.setLayout(null);
name=JOptionPane.showInputDialog(null,"ENTER YOUR NAME");
coll=JOptionPane.showInputDialog(null,"ENTER YOUR COLLEAGE");
ImageIcon w=new ImageIcon("play.jpg");
ImageIcon x=new ImageIcon("exit.jpg");
ImageIcon y=new ImageIcon("about.jpg");
ImageIcon wq=new ImageIcon("scor.jpg");
b1=new JButton(x);
b2=new JButton(y);
b3=new JButton(wq);
b4=new JButton(w);
easy=new JRadioButton("EASY",true);
med=new JRadioButton("MEDIUM",false);
hard=new JRadioButton("HARD",false);
easy.setFont(new Font("Andalus",1,20));
med.setFont(new Font("Andalus",1,20));
hard.setFont(new Font("Andalus",1,20));
easy.setOpaque(false);
med.setOpaque(false);
hard.setOpaque(false);
bu= new ButtonGroup();
bu.add(easy);bu.add(hard);bu.add(med);
p1.add(b1);
p1.add(b2);
p1.add(b3);
p1.add(b4);
p1.add(easy);
p1.add(hard);
p1.add(med);
b1.setBounds(400,600,205,70);
b2.setBounds(400,500,205,70);
b3.setBounds(400,400,205,70);
b4.setBounds(400,260,205,70);
easy.setBounds(380,350,100,40);
med.setBounds(460,350,150,40);
hard.setBounds(570,350,100,40);
f1.add(p1);
f1.setVisible(true);
f1.setSize(1240,900);
b4.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event)
{
if(easy.isSelected())
{
if(!en1)
{
en1=true;
i=1;
t=1200;
f=new JFrame("EASY");
p=new AboutPanel2();
p.setLayout(null);
ImageIcon y1=new ImageIcon("Sonic_Running_by_Adam_Novagen.jpg");
ImageIcon e4=new ImageIcon("exit1.jpg");
click=new JButton(y1);
lost2=new JButton(e4);
click.setBackground(Color.black);
click.setForeground(Color.yellow);
click.setBounds(400,200,110,60);
lost2.setBounds(0,0,200,67);
p.add(click);
p.add(lost2);
PrintThread2 a=new PrintThread2();
if(i==1)
JOptionPane.showMessageDialog(null,"LEVEL 1");
a.start();
click.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event)
{
if(i==5)
{ click.setVisible(false); JOptionPane.showMessageDialog(null,"LAST LEVEL");
click.setBackground(Color.red);
click.setForeground(Color.black);
click.setVisible(true);}
else
if(i!=6)
{click.setVisible(false);JOptionPane.showMessageDialog(null,"LEVEL "+(i+1));
click.setVisible(true);}
if(t<=200)
{
click.setVisible(false); JOptionPane.showMessageDialog(null,name+ ":- YOU WIN THE EASY LEVEL ");eas1=true;f.setVisible(false);if(med1&&ha1&&eas1)win();
}
else
{
t-=200;
i++;}
}});
lost2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event)
{f.setVisible(false);if(en1&&en2&&en3)lose();}});
f.add(p);
f.setSize(1240,900);
f.setVisible(true);
easy.setEnabled(false);
}
else
JOptionPane.showMessageDialog(null,name+":- YOU PLAY THIS LEVEL BEFORE");
}
else
if(hard.isSelected())
{
if(!en2)
{
en2=true;
t1=1200;
count=30;
fl=true;
fl1=true;
f12=false;f22=false;f3=false;
f2=new JFrame("HARD");
p2=new AboutPanel2();
p2.setLayout(null);
l=new JLabel(count+"");
ImageIcon e1=new ImageIcon("Sonic_Running_by_Adam_Novagen.jpg");
ImageIcon e2=new ImageIcon("assist16_080314awk05.jpg");
ImageIcon e3=new ImageIcon("tails.gif");
ImageIcon e4=new ImageIcon("exit1.jpg");
click1=new JButton(e1);
click2=new JButton(e2);
click3=new JButton(e3);
lost=new JButton(e4);
lost.setBounds(20,0,200,67);
l.setBounds(10,10,60,30);
click1.setBounds(100,100,100,30);
click2.setBounds(100,100,100,30);
click3.setBounds(100,100,100,30);
click1.setBackground(Color.black);
click1.setForeground(Color.yellow);
click2.setBackground(Color.black);
click2.setForeground(Color.yellow);
click3.setBackground(Color.black);
click3.setForeground(Color.yellow);
click1.setLocation((10+(int)(Math.random()*700)),(10+(int)(Math.random()*700)));
click2.setLocation((10+(int)(Math.random()*700)),(10+(int)(Math.random()*700)));
click3.setLocation((10+(int)(Math.random()*700)),(10+(int)(Math.random()*700)));
l.setFont(new Font("Andalus",1,20));
p2.add(l);p2.add(click1);p2.add(click2);p2.add(click3);p2.add(lost);
click1.setVisible(true);click2.setVisible(true);click3.setVisible(true);
PrintThread a1=new PrintThread();
if(i1==1)
JOptionPane.showMessageDialog(null,"LEVEL 1");
a1.start();
click1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event)
{
f12=true;
click1.setVisible(false);
if(f12&&f22&&f3)
{
if(i1==5)
{ l.setVisible(false);fl=false;JOptionPane.showMessageDialog(null,"LAST LEVEL");
click1.setBackground(Color.red);
click1.setForeground(Color.black);
click2.setBackground(Color.red);
click2.setForeground(Color.black);
click3.setBackground(Color.red);
click3.setForeground(Color.black);
fl=true;l.setVisible(true);click1.setVisible(true);click2.setVisible(true);click3.setVisible(true);count=30;}
else
if(i1!=6)
{l.setVisible(false);fl=false;JOptionPane.showMessageDialog(null,"LEVEL "+(i1+1));fl=false;l.setVisible(true);click1.setVisible(true);click2.setVisible(true);click3.setVisible(true);count=30;}
if(t1<=200)
{
l.setVisible(false);fl=false;JOptionPane.showMessageDialog(null,name+":- YOU WIN THE HARD LEVEL");ha1=true;fl=false;f2.setVisible(false);if(med1&&ha1&&eas1)win();i1=0;fl1=false;
}
else
{
t1-=200;
i1++;}
f12=false;f22=false;f3=false; }
}});
click2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event)
{
f22=true;
click2.setVisible(false);
if(f12&&f22&&f3)
{
if(i1==5)
{ l.setVisible(false);fl=false;JOptionPane.showMessageDialog(null,"LAST LEVEL");
click1.setBackground(Color.red);
click1.setForeground(Color.black);
click2.setBackground(Color.red);
click2.setForeground(Color.black);
click3.setBackground(Color.red);
click3.setForeground(Color.black);fl=true;l.setVisible(true);click1.setVisible(true);click2.setVisible(true);click3.setVisible(true);count=30;}
else
if(i1!=6)
{l.setVisible(false);fl=false;JOptionPane.showMessageDialog(null,"LEVEL "+(i1+1));fl=false;l.setVisible(true);click1.setVisible(true);click2.setVisible(true);click3.setVisible(true);count=30;}
if(t1<=200)
{
l.setVisible(false);fl=false; JOptionPane.showMessageDialog(null,name+":- YOU WIN THE HARD LEVEL");ha1=true;fl=false;f2.setVisible(false);if(med1&&ha1&&eas1)win();i1=0;fl1=false;
}
else
{
t1-=200;
i1++;}
f12=false;f22=false;f3=false; }
}});
click3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event)
{
f3=true;
click3.setVisible(false);
if(f12&&f22&&f3)
{
if(i1==5)
{l.setVisible(false);fl=false;JOptionPane.showMessageDialog(null,"LAST LEVEL");
click1.setBackground(Color.red);
click1.setForeground(Color.black);
click2.setBackground(Color.red);
click2.setForeground(Color.black);
click3.setBackground(Color.red);
click3.setForeground(Color.black);fl=true;l.setVisible(true);click1.setVisible(true);click2.setVisible(true);click3.setVisible(true);count=30;}
else
if(i1!=6)
{l.setVisible(false);fl=false;JOptionPane.showMessageDialog(null,"LEVEL "+(i1+1));fl=false;l.setVisible(true);click1.setVisible(true);click2.setVisible(true);click3.setVisible(true);count=30;}
if(t1==200)
{
l.setVisible(false);fl=false;JOptionPane.showMessageDialog(null,name+":- YOU WIN THE HARD LEVEL");ha1=true;fl=false;f2.setVisible(false);if(med1&&ha1&&eas1)win();i1=0;fl1=false;
}
else
{
t1-=200;
i1++;}
f12=false;f22=false;f3=false;}
}});
lost.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event)
{f2.setVisible(false);if(en1&&en2&&en3)lose();}});
f2.add(p2);
f2.setVisible(true);
f2.setSize(1249,900);
hard.setEnabled(false);}
else
JOptionPane.showMessageDialog(null,name+" :- YOU PLAY THIS LEVEL BEFOR");
}
else
if(med.isSelected())
{
if(!en3){
en3=true;
f4=new JFrame("MEDIUM");
p3=new AboutPanel2();
p3.setLayout(null);
ImageIcon s1=new ImageIcon("Sonic_Running_by_Adam_Novagen.jpg");
ImageIcon s2=new ImageIcon("assist16_080314awk05.jpg");
ImageIcon s3=new ImageIcon("tails.gif");
ImageIcon e4=new ImageIcon("exit1.jpg");
click4=new JButton(s1);
click5=new JButton(s2);
click6=new JButton(s3);
lost1=new JButton(e4);
cl=new JLabel(count1+"");
handler h = new handler();
addMouseMotionListener(h);
cl.setFont(new Font("Andalus",1,20));
click4.setBounds(100,100,100,30);
lost1.setBounds(0,0,200,67);
cl.setBounds(200,0,200,67);
click5.setBounds(100,100,100,30);
click6.setBounds(100,100,100,30);
click4.setBackground(Color.black);
click4.setForeground(Color.yellow);
click5.setBackground(Color.black);
click5.setForeground(Color.yellow);
click6.setBackground(Color.black);
click6.setForeground(Color.yellow);
click4.setLocation((10+(int)(Math.random()*700)),(10+(int)(Math.random()*700)));
click5.setLocation((10+(int)(Math.random()*700)),(10+(int)(Math.random()*700)));
click6.setLocation((10+(int)(Math.random()*700)),(10+(int)(Math.random()*700)));
p3.add(cl); p3.add(click4);p3.add(click5);p3.add(click6);p3.add(lost1);
PrintThread3 a2=new PrintThread3();
if(i2==1)
JOptionPane.showMessageDialog(null,"LEVEL 1");
a2.start();
f4.add(p3);
f4.setVisible(true);
f4.setSize(1249,900);
click4.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event)
{
f13=true;
click4.setVisible(false);
if(f13&&f23&&f33)
{
if(i2==5)
{ JOptionPane.showMessageDialog(null,"LAST LEVEL");
click4.setBackground(Color.red);
click4.setForeground(Color.black);
click5.setBackground(Color.red);
click5.setForeground(Color.black);
click6.setBackground(Color.red);
click6.setForeground(Color.black);click4.setVisible(true);click5.setVisible(true);click6.setVisible(true);}
else
if(i2!=6)
{JOptionPane.showMessageDialog(null,"LEVEL "+(i2+1));click4.setVisible(true);click5.setVisible(true);click6.setVisible(true);}
if(t2<=200)
{
JOptionPane.showMessageDialog(null,name+":- YOU WIN THE MEDIUM LEVEL");med1=true;f4.setVisible(false);if(med1&&ha1&&eas1)win();i2=0;
}
else
{
t2-=200;
i2++;}
f13=false;f23=false;f33=false; }
}});
click5.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event)
{
f23=true;
click5.setVisible(false);
if(f13&&f23&&f33)
{
if(i2==5)
{ JOptionPane.showMessageDialog(null,"LAST LEVEL");
click4.setBackground(Color.red);
click4.setForeground(Color.black);
click5.setBackground(Color.red);
click5.setForeground(Color.black);
click6.setBackground(Color.red);
click6.setForeground(Color.black);click4.setVisible(true);click5.setVisible(true);click6.setVisible(true);}
else
if(i2!=6)
{JOptionPane.showMessageDialog(null,"LEVEL "+(i2+1));click4.setVisible(true);click5.setVisible(true);click6.setVisible(true);}
if(t2<=200)
{
JOptionPane.showMessageDialog(null,name+":- YOU WIN THE MEDIUM LEVEL");med1=true;f4.setVisible(false);if(med1&&ha1&&eas1)win();i2=0;
}
else
{
t2-=200;
i2++;}
f13=false;f23=false;f33=false; }
}});
click6.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event)
{
f33=true;
click6.setVisible(false);
if(f13&&f23&&f33)
{
if(i2==5)
{JOptionPane.showMessageDialog(null,"LAST LEVEL");
click4.setBackground(Color.red);
click4.setForeground(Color.black);
click5.setBackground(Color.red);
click5.setForeground(Color.black);
click6.setBackground(Color.red);
click6.setForeground(Color.black);click4.setVisible(true);click5.setVisible(true);click6.setVisible(true);}
else
if(i2!=6)
{JOptionPane.showMessageDialog(null,"LEVEL "+(i2+1));click4.setVisible(true);click5.setVisible(true);click6.setVisible(true);}
if(t2==200)
{
JOptionPane.showMessageDialog(null,name+":- YOU WIN THE MEDIUM LEVEL");med1=true;f4.setVisible(false);if(med1&&ha1&&eas1)win();i2=0;
}
else
{
t2-=200;
i2++;}
f13=false;f23=false;f33=false;}
}});
lost1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event)
{f4.setVisible(false);if(en1&&en2&&en3)lose();}});
med.setEnabled(false);
}
else
JOptionPane.showMessageDialog(null,name+":- YOU PLAY THIS LEVEL BEFORE ");}
}});
b2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event)
{
t12=new JFrame("ABOUT ME");
JPanel z=new AboutPanel();
z.setLayout(null);
ImageIcon x123=new ImageIcon("exit.jpg");
JButton x=new JButton(x123);
z.add(x);
x.setBounds(12,400,205,70);
t12.add(z);
t12.setVisible(true);
t12. setSize(800,600);
t12.setLocation(100,12);
x.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event)
{t12.setVisible(false);}});
}});
b3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event)
{
JFrame g=new JFrame("all winner");
JPanel o=new AboutPanel5();
o.setLayout(null);
ImageIcon x123=new ImageIcon("exit.jpg");
JLabel l=new JLabel();
JLabel m=new JLabel();
JLabel n=new JLabel();
l.setBounds(100,as,100,100);
m.setBounds(400,as,100,100);
n.setBounds(800,as,100,100);
l.setFont(new Font("Andalus",1,20));
m.setFont(new Font("Andalus",1,20));
n.setFont(new Font("Andalus",1,20));
try
{
RandomAccessFile read2=new RandomAccessFile("count.dat","r");
count3=read2.readInt();
read2.close();System.out.print(count3);
RandomAccessFile read=new RandomAccessFile("scores.dat","r");
for(int i=0;i<count3;i++)
{
as+=100;
l.setText(read.readUTF());m.setText(read.readUTF());n.setText(read.readInt()+"");
System.out.println(l.getText()+" "+m.getText()+" "+n.getText());
l.setLocation(100,as);m.setLocation(400,as);n.setLocation(800,as);
String x=read.readUTF();}
}catch(Exception e){e.printStackTrace();}
JButton s=new JButton(x123);
s.setBounds(0,600,200,67);
o.add(s);
o.add(l);o.add(m);o.add(n);
g.add(o);
g.setVisible(true);
g.setSize(1024,800);
s.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event)
{System.exit(0);}});
}});
b1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event)
{System.exit(0);}});
}
public void win()
{
f1.setVisible(false);
JFrame x=new JFrame("WINNER "+name);
JPanel z=new AboutPanel3();
z.setLayout(null);
ImageIcon z12=new ImageIcon("exit.jpg");
JLabel w=new JLabel("Congratulation "+name);
sum=18;
w.setForeground(Color.red);
JButton n=new JButton(z12);
n.setBounds(0,400,200,67);
w.setFont(new Font("Andalus",1,30));
w.setBounds(50,200,600,200);
z.add(w);
z.add(n);
x.add(z);
try{
RandomAccessFile read2=new RandomAccessFile("count.dat","r");
count2=read2.readInt();
count2++;
read2.close();
}catch(Exception e){e.printStackTrace();}
try{
write=new RandomAccessFile("count.dat","rwd");
write.writeInt(count2);
write.close();
re=new RandomAccessFile("scores.dat","rw");
re.skipBytes((int)(re.length()));
re.writeUTF(name);
re.writeUTF(coll);
re.writeInt(sum);
re.writeUTF("\n");
}catch(Exception e){e.printStackTrace();}
x.setVisible(true);
x.setSize(511,500);
x.setLocation(100,100);
n.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event)
{System.exit(0);}});
}
public void lose()
{
f1.setVisible(false);
JFrame x=new JFrame("LOSER "+name);
JPanel z=new AboutPanel4();
z.setLayout(null);
JLabel w=new JLabel(name+" YOU PLAY THE LEVEL EASY TO "+i);
JLabel w1=new JLabel("AND THE LEVEL MEDIUM TO "+(i2));
JLabel w2=new JLabel("AND THE LEVEL HARD TO "+(i1));
sum=i+i2+i1;
ImageIcon z123=new ImageIcon("exit.jpg");
JButton n=new JButton(z123);
n.setBounds(0,300,200,67);
w.setFont(new Font("Andalus",1,16));
w1.setFont(new Font("Andalus",1,16));
w2.setFont(new Font("Andalus",1,16));
w.setForeground(Color.red);
w1.setForeground(Color.red);
w2.setForeground(Color.red);
w.setBounds(100,100,600,100);
w1.setBounds(100,120,600,100);
w2.setBounds(100,140,600,100);
z.add(w);z.add(w1);z.add(w2);
z.add(n);
x.add(z);
try{
RandomAccessFile read2=new RandomAccessFile("count.dat","r");
count2=read2.readInt();
count2++;
read2.close();
}catch(Exception e){e.printStackTrace();}
try{
write1=new RandomAccessFile("count.dat","rwd");
write1.writeInt(count2);
write1.close();
re=new RandomAccessFile("scores.dat","rw");
re.skipBytes((int)(re.length()));
re.writeUTF(name);
re.writeUTF(coll);
re.writeInt(sum);
re.writeUTF("\n");
}catch(Exception e){e.printStackTrace();}
x.setVisible(true);
x.setSize(450,450);
n.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event)
{System.exit(0);}});
}
public static void main(String args[])
{
x=new demo();
}
class PrintThread extends Thread {
public void run()
{
try {
if(count==0&&fl&&fl1)
{JOptionPane.showMessageDialog(null,"YOUR TIME IS FINISH");f2.setVisible(false);if(en1&&en2&&en3)lose();count=30;fl=false;}
l.setText(count+"");
count--;
}
catch(Exception e)
{
e.printStackTrace();
}
try {
Thread.sleep(t1);
click1.setLocation((10+(int)(Math.random()*700)),(10+(int)(Math.random()*700)));
click2.setLocation((10+(int)(Math.random()*700)),(10+(int)(Math.random()*700)));
click3.setLocation((10+(int)(Math.random()*700)),(10+(int)(Math.random()*700)));
run();
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
class PrintThread2 extends Thread {
public void run()
{
try {
Thread.sleep(t);
click.setLocation((10+(int)(Math.random()*700)),(10+(int)(Math.random()*700)));
run();
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
class PrintThread3 extends Thread {
public void run()
{
try {
Thread.sleep(t2);
click4.setLocation((10+(int)(Math.random()*700)),(10+(int)(Math.random()*700)));
click5.setLocation((10+(int)(Math.random()*700)),(10+(int)(Math.random()*700)));
click6.setLocation((10+(int)(Math.random()*700)),(10+(int)(Math.random()*700)));
run();
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
class AboutPanel extends JPanel {
ImageIcon aboutimage = null;
public AboutPanel() {
aboutimage=new ImageIcon("sonic-speed.jpg");
setOpaque(false);
}
public void paint(Graphics g) {
aboutimage.paintIcon(this, g, 0, 0);
super.paint(g);
}
public Dimension getPreferredSize() {
return new Dimension(aboutimage.getIconWidth(),
aboutimage.getIconHeight());
}}
class AboutPanel1 extends JPanel {
ImageIcon aboutimage = null;
public AboutPanel1() {
aboutimage=new ImageIcon("Sonic-Rush-Adventure-Soundtrack.jpg");
setOpaque(false);
}
public void paint(Graphics g) {
aboutimage.paintIcon(this, g, 0, 0);
super.paint(g);
}
public Dimension getPreferredSize() {
return new Dimension(aboutimage.getIconWidth(),
aboutimage.getIconHeight());
}}
class AboutPanel2 extends JPanel {
ImageIcon aboutimage = null;
public AboutPanel2() {
aboutimage=new ImageIcon("back.jpg ");
setOpaque(false);
}
public void paint(Graphics g) {
aboutimage.paintIcon(this, g, 0, 0);
super.paint(g);
}
public Dimension getPreferredSize() {
return new Dimension(aboutimage.getIconWidth(),
aboutimage.getIconHeight());
}}
class AboutPanel3 extends JPanel {
ImageIcon aboutimage = null;
public AboutPanel3() {
aboutimage=new ImageIcon("congratulations_party-2309.gif");
setOpaque(false);
}
public void paint(Graphics g) {
aboutimage.paintIcon(this, g, 0, 0);
super.paint(g);
}
public Dimension getPreferredSize() {
return new Dimension(aboutimage.getIconWidth(),
aboutimage.getIconHeight());
}}
class AboutPanel4 extends JPanel {
ImageIcon aboutimage = null;
public AboutPanel4() {
aboutimage=new ImageIcon("tempalbumart2.jpg");
setOpaque(false);
}
public void paint(Graphics g) {
aboutimage.paintIcon(this, g, 0, 0);
super.paint(g);
}
public Dimension getPreferredSize() {
return new Dimension(aboutimage.getIconWidth(),
aboutimage.getIconHeight());
}}
class AboutPanel5 extends JPanel {
ImageIcon aboutimage = null;
public AboutPanel5() {
aboutimage=new ImageIcon("Unofficial_Windows_7_Wallpaper_by_JurgenDoe.jpg");
setOpaque(false);
}
public void paint(Graphics g) {
aboutimage.paintIcon(this, g, 0, 0);
super.paint(g);
}
public Dimension getPreferredSize() {
return new Dimension(aboutimage.getIconWidth(),
aboutimage.getIconHeight());
}}
public class handler extends MouseMotionAdapter
{
public void mouseClicked(MouseEvent event)
{
count1-=event.getClickCount();
cl.setText("You have "+count1+" Clickes");
}
}
}