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

hello......
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)........my pic applet is in one file...and the frame is in another file

thannks
bhuey_lingAsked:
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.

vivexpCommented:
Hi,

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.

or

Create a singleton class ...

Try out....



 
0

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:
hello....
well ..actually wat i use dialog box.......but i thinnk it is same as frame......could u be more specified......like write the code....i dun know how to handle this between 2 file..thanx
0
vivexpCommented:
Hi,

I created two files Frame1.java  and StandardDialog1.java extends JDialog.

Ur Frame can also be an applet.

In Frame1.java
Declare...
public static boolean dialogflg=true;


Under mousemovelistener ()
if(sdf==true){
    StandardDialog1 sd = new StandardDialog1(this);
    sd.show (true);
    dialogflag=false;
  }
 }

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

Try out...


0
bhuey_lingAuthor Commented:
hello!
i would like to ask if i want the boolean activate each time the dialog box dipose...how can i do it?

thanx.....
0
bhuey_lingAuthor Commented:
hello!.....
below is my program ....it 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 area.....how to solve it?


boolean dialogflg = true;
    public boolean mouseMove(Event e, int x, int y){  
      Frame f=new Frame("InfoDialog Test");
      f.resize(100,50);
      InfoDialog dlg=new InfoDialog(f,"Think about it!",
      " hahaha");      
      if(x<180 && x>10 && y<190 && y>10&&dialogflg==true){              
      dlg.show(true);
      dialogflg=false;
      }
      else if(x>180 || x<10){
           dialogflg=true;
      }                  
      return true;
    }
0
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.