bhuey_ling
asked on
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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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...
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...
ASKER
hello!
i would like to ask if i want the boolean activate each time the dialog box dipose...how can i do it?
thanx.....
i would like to ask if i want the boolean activate each time the dialog box dipose...how can i do it?
thanx.....
ASKER
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;
}
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;
}
ASKER
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