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?????

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

}

}
--------------------------------------------------------------------------------

Last edited by shabbir; 21Aug2007 at 08:25.. Reason: Code block