1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

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

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

  1. stack

    stack New Member

    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:

    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){
        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

    please help me!!!!
  3. stack

    stack New Member


Share This Page