This week's book giveaway is in the JavaFX forum.
We're giving away four copies of Introducing JavaFX 8 Programming and have Herbert Schildt on-line!
See this thread for details.
The moose likes Applets and the fly likes How do you show a component that has focus? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "How do you show a component that has focus?" Watch "How do you show a component that has focus?" New topic
Author

How do you show a component that has focus?

Loni Chung
Greenhorn

Joined: Apr 04, 2003
Posts: 1
I have an applet that is longer than the browser screen, so the user must scroll down the browser window to see the bottom of it.
When I call requestFocus() on a textbox that is at the top of the applet, the keyboard focus moves to the correct textbox, but if the user is scrolled down to the bottom of the applet, the page does not scroll up.
How do I automatically scroll up and make that textbox visible when it has keyboard focus?
Thanks.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17142
    
  27

Hi "L Chung", welcome to the JavaRanch. We have a naming policy here, which I hope someday they'll get around to placing where people can see it before they set up account names that don't conform. You can find it Here. Thanks!
IMHO this is a sticky problem, since the applet doesn't really know that much about the window and web page it's embedded in and vice versa. The best solution is probably to design the applet so it will all fit in a window that's no more than 800x600 pizels in size. You might either make multiple applets or use tabs so that a single applet has multiple pages.
To actually make things scroll, I think you'd have to write both extra applet Java code AND some JavaScript to make the window and applet co-operate and it would probably be a lot of work.


An IDE is no substitute for an Intelligent Developer.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do you show a component that has focus?
 
It's not a secret anymore!