how to pop up a frame when mouse at certain area?

i have a applet which cointain a pic, and i would like to pop up a frame when user's mouse move around that area.....but it always pop up to many frame(i think so, bcoz i have to close many time only the frame close) pic applet is in one file...and the frame is in another file

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


Use a static boolen variable which will keep track of the instance created by pop up frame class. Then u can avoid creating multiple instances of the same frame.


Create a singleton class ...

Try out....


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bhuey_lingAuthor Commented:
well ..actually wat i use dialog box.......but i thinnk it is same as frame......could u be more write the code....i dun know how to handle this between 2 file..thanx

I created two files  and extends JDialog.

Ur Frame can also be an applet.

public static boolean dialogflg=true;

Under mousemovelistener ()
    StandardDialog1 sd = new StandardDialog1(this); (true);

Compile both the files and put them in the same package.

Try out...

bhuey_lingAuthor Commented:
i would like to ask if i want the boolean activate each time the dialog box can i do it?

bhuey_lingAuthor Commented:
below is my program is written in old style (didn't use listener)....but it have a problem that it pop up two dialog box each time my mouse come to that to solve it?

boolean dialogflg = true;
    public boolean mouseMove(Event e, int x, int y){  
      Frame f=new Frame("InfoDialog Test");
      InfoDialog dlg=new InfoDialog(f,"Think about it!",
      " hahaha");      
      if(x<180 && x>10 && y<190 && y>10&&dialogflg==true){           ;
      else if(x>180 || x<10){
      return true;
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Internet Marketing

From novice to tech pro — start learning today.