|
||||||
| Java Help Java Help forum discussing all Java platforms - J2ME, J2SE and J2EE - as well as relevant standards, APIs and frameworks such as Swing, Servlets, JSPs, Applets, Struts, Spring, Hibernate, ANT, EJB, and other Java-related topics. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
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 09:51 AM. Reason: Added cote-tags. |
| Sponsored Links |
|
|
|
|||
|
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... |
|
|||||
|
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.
Quote:
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.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | My Blog Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall |
| Sponsored Links |
|
|
|
|||||
|
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.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum Programming is a branch of mathematics. |
|
|||||
|
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.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | My Blog Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Peculiar UI Problem Needs Tackling | adriyel | C# Programming | 2 | 04-06-2008 08:46 AM |
| [C] Comparison problem | Alhazred | C and C++ | 1 | 08-29-2007 05:58 AM |
| A small problem in the output | The_Master | C and C++ | 3 | 12-13-2006 01:04 PM |
| WingedPanther | ........ | 2753.6 |
| Xav | ........ | 2704 |
| Brandon W | ........ | 1702.32 |
| John | ........ | 1207.73 |
| marwex89 | ........ | 1175.24 |
| morefood2001 | ........ | 966.05 |
| dcs | ........ | 655.75 |
| Steve.L | ........ | 475.59 |
| orjan | ........ | 418.58 |
| Aereshaa | ........ | 383.54 |