wood burning stoves 2.0*
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 Android Security Essentials Live Lessons this week in the Android 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: 15959
    
  19

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
Don't get me started about those stupid light bulbs.
 
subject: How do you show a component that has focus?
 
Similar Threads
scroling in an eclipse editor
when focus to select drop down focus go to textbox, how do?\
JComboBox drop UP instead of DOWN --- AND --- FOCUS ISSUE
Applet Repaint
create an on screen keyboard that run on linux