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: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 v0id; 08-20-2007 at 06:51 AM. Reason: Added cote-tags.
do you have a solution to my problem???
i need a help please....
please help me,,
it is not possible that all java applet window must be in the same size!!! ... i want to know how to solve Recurrence problem for JOptionPane window !!!
i want the JOptionPane window appear one time if i click in the java applet window at any time...
where are you???!!!
Is there is any thing which is Incomprehensible in my Expression??
There is no need to excessively bump your posts. When someone who knows the answer reads your post, it will get answered, until then be patient.
And since you asked, your excessive use of punctuation where it is unneeded, and your ill-use of punctuation where it is needed does make your posts rather incomprehensible.
Moreover, after four posts in a row, I am still unclear of what you are exactly asking, if you can, ask your question in a single sentence and make it as clear as possible.
i'm very sorry ,but i'm very worry...
run my code and you will know the problem
I'll add my interpretation:
You have a button you press to open a "pop up"
When you press it, it creates a pop-up window with a message, which you close.
When you press it again, it creates 2 pop-ups
when you press it again, it creates 3 pop-ups
etc.
It's supposed to create 1 pop-up each time.
My thought is that each button press creates, but does not destroy a popup. As a result, when you "show" a popup the second time, it shows BOTH existing popups.
I don't know Java well enough to know if this is what's actually happening, but that's my theory.
If you click the Applet window, the Dialog box will appear, if you click the Applet window again, the Applet is the window that is focused and it dialog box is behind the applet, if you move the applet window / resize it, you will still see the dialog box.
From what I see, there is nothing wrong with your code, it does exactly what you have coded it to do.
I agree from what I see, there is nothing wrong with your code, it does exactly what you have coded it to do.
What is it you are trying to make? Your writing is unreadable...
So if you need help try and use your commas like this (Hi, how are you) not Hi ,how are you.)
-S
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks