Skip to main content

Applet Tooltips on wrong screen with multi-screen display

4 replies [Last post]
jrmcdaniel
Offline
Joined: 2004-08-31

I tried both the JToolTip approach as well as writing my own "tooltip" using JWindow and am having trouble getting either to put the "tooltip" on the same screen as the applet. It all works fine if the applet is on the "main" screen but the tooltip appears always on the main screen when the applet is on one of the other screens. It works fine for most everything other than an applet.

I tried to find the "magic" for putting a JWindow on the same screen as the applet but have not figured this out so far. If that can be solved, then I can abandon using the JToolTip and do it myself.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
anthony_p
Offline
Joined: 2006-07-24

By the way, could you provide a small code snippet that shows how you create/setBounds()/setVisible() your window?

Perhaps using the current mouse coordinates could help calculate the correct position for your new window...

anthony_p
Offline
Joined: 2006-07-24

Did you try using the following constructor of JWindow:

http://java.sun.com/javase/6/docs/api/javax/swing/JWindow.html#JWindow(java.awt.GraphicsConfiguration)

?
You can obtain the GC of your applet using the JApplet.getGraphicsConfiguration() method (inherited from the Component class).
Generally, if you create your JWindow using the same GC, it should appear on the same screen as your applet.

jrmcdaniel
Offline
Joined: 2004-08-31

I tried that although my approach could have been wrong. As I remember, I got the GraphicConfiguration of the applet (this.getGraphicConfiguration() or something like that). I can't remember in looking through the JTookKit code whether they had a different approach but that does not work, either.

anthony_p
Offline
Joined: 2006-07-24

Yeah, I've just found out that Applets do not track their GC correctly. Well, then currently it's simply impossible. Sorry. You might want to file a bug at bugs.sun.com.