Applet focus issue

Q

Qu0ll

I have a relatively simple JApplet that has a tool bar in the NORTH region
and a JPanel in the CENTER region of the applet's BorderLayout. The
JButtons on the tool bar have tool tip text associated with them.

The problem is that the tool tip text is only displayed when the applet has
focus (or so it seems) so when another application window is activated in
front of the browser window and then the browser window re-activated
(regains focus), the tool tips are not displayed (presumably because the
applet doesn't automatically have focus) until a control within the applet
is clicked on. The impression the user gets is that there are no tool tips
available at this time.

I have added listeners on the focus gained and component shown events of the
applet itself and neither is invoked when the browser window regains focus
so how can I respond to the fact that the browser window regained focus?
And why does the applet not appear to have focus when the browser regains
focus?

In other words, how can I assure that the tool tips will be always displayed
even when the browser window loses focus and then regains it?

I am using Java 6 Update 12 on Windows Vista and I have tried both IE 7 and
Firefox 3.0.6 browsers.

--
And loving it,

-Qu0ll (Rare, not extinct)
_________________________________________________
(e-mail address removed)
[Replace the "SixFour" with numbers to email me]
 
D

Dave Miller

Qu0ll said:
I have a relatively simple JApplet that has a tool bar in the NORTH
region and a JPanel in the CENTER region of the applet's BorderLayout.
The JButtons on the tool bar have tool tip text associated with them.

The problem is that the tool tip text is only displayed when the applet
has focus (or so it seems) so when another application window is
activated in front of the browser window and then the browser window
re-activated (regains focus), the tool tips are not displayed
(presumably because the applet doesn't automatically have focus) until a
control within the applet is clicked on. The impression the user gets
is that there are no tool tips available at this time.

I have added listeners on the focus gained and component shown events of
the applet itself and neither is invoked when the browser window regains
focus so how can I respond to the fact that the browser window regained
focus? And why does the applet not appear to have focus when the browser
regains focus?

In other words, how can I assure that the tool tips will be always
displayed even when the browser window loses focus and then regains it?

I am using Java 6 Update 12 on Windows Vista and I have tried both IE 7
and Firefox 3.0.6 browsers.
You can try naming the applet element within the html document and then
using javascript onfocus to send the browser focus to the element.
 
K

Knute Johnson

Qu0ll said:
I have a relatively simple JApplet that has a tool bar in the NORTH
region and a JPanel in the CENTER region of the applet's BorderLayout.
The JButtons on the tool bar have tool tip text associated with them.

The problem is that the tool tip text is only displayed when the applet
has focus (or so it seems) so when another application window is
activated in front of the browser window and then the browser window
re-activated (regains focus), the tool tips are not displayed
(presumably because the applet doesn't automatically have focus) until a
control within the applet is clicked on. The impression the user gets
is that there are no tool tips available at this time.

I have added listeners on the focus gained and component shown events of
the applet itself and neither is invoked when the browser window regains
focus so how can I respond to the fact that the browser window regained
focus? And why does the applet not appear to have focus when the browser
regains focus?

In other words, how can I assure that the tool tips will be always
displayed even when the browser window loses focus and then regains it?

I am using Java 6 Update 12 on Windows Vista and I have tried both IE 7
and Firefox 3.0.6 browsers.

I've seen this problem and on Linux sometimes you can't get the focus
back on the applet. I like Dave's idea of using JavaScript. If that
works, please post back your code for that.
 
Q

Qu0ll

Dave Miller said:
You can try naming the applet element within the html document and then
using javascript onfocus to send the browser focus to the element.

Thanks Dave - that sounds like a good idea. Unfortunately my JavaScript
skills are pretty poor but I'll try to whip up something.

--
And loving it,

-Qu0ll (Rare, not extinct)
_________________________________________________
(e-mail address removed)
[Replace the "SixFour" with numbers to email me]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top