1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

Discussion in 'Java' started by stack, Aug 20, 2007.

  1. stack

    stack New Member

    Joined:
    Aug 20, 2007
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    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
    
    }
    
    }
    --------------------------------------------------------------------------------
     
    Last edited by a moderator: Aug 21, 2007
  2. stack

    stack New Member

    Joined:
    Aug 20, 2007
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    please help me!!!!
     
  3. stack

    stack New Member

    Joined:
    Aug 20, 2007
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    ????????????????
     

Share This Page