Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Java (http://www.go4expert.com/forums/java/)
-   -   i have a problem please help me!!!???? (http://www.go4expert.com/forums/i-help-t5956/)

stack 21Aug2007 02:53

i have a problem please help me!!!????
 
Hi,
i have a problem with the following code.. the problem is: if i run the java applet window and if I click in it in the first time ,the JOptionPane window appear one time and if i click OK button ,the JOptionPane window Disappear..
If i click in the java applet window in the second time ,the JOptionPane window appear and if i click OK button the JOptionPane window appers again and if i click OK button the JOptionPane window Disappear..and So On with third ,fourth.....etc times. the the JOptionPane window appears with Increase in each time!!!

if i delete setSize(900,600),the problem disappear !!!!
i can't delete the setSize method, because i need this size pleaze..

How can I solve this problem????? :confused:

Code:
Code:

import javax.swing.JApplet;
import javax.swing.JOptionPane;
import java.awt.Graphics;
import java.awt.event.MouseListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseMotionListener;
import java.awt.Color;

public class HH extends JApplet
{
 public void init(){

setSize(900,600); //<< Here is the reason of the problem

}

 public void paint(Graphics g){

  addMouseListener(
    new MouseAdapter()
        {
       
                public void mouseClicked( MouseEvent event)
                {
                       
           
                       
                      JOptionPane.showMessageDialog( null, "Welcome ",
        "welcome##",JOptionPane.INFORMATION_MESSAGE  );

                                                               

                }//end of mouseClicked


        }// end anonymous inner class
        );// end call to addMouseListener

}

}

--------------------------------------------------------------------------------

stack 21Aug2007 15:38

Re: i have a problem please help me!!!????
 
please help me!!!!

stack 22Aug2007 04:33

Re: i have a problem please help me!!!????
 
????????????????


All times are GMT +5.5. The time now is 02:19.