The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

This topic is READ ONLY
import-bot (20211) [Avatar] Offline
#1
[Originally posted by ian]


Hi,

I have a bunch of JTextfields in a panel. How can I force the default editing
position to be any one of (say) 10 JTextfields active on the screen. These
fields are in a panel in a JTabbed pane and when the tab changes, I need to
start the editing at a selected position.

Many, many thanks. This is a neat forum.

Cheers
import-bot (20211) [Avatar] Offline
#2
Re: Edit Focus Policy Question
[Originally posted by matt]

Add a ChangeListener to your tabbed pane, and in the stateChanged method
check to see if the tabe containing the panel you are talking about
is the active one. If it is, call requestFocus() on the JTextField you
want to have the default focus. This will put the cursor in that text
field each time the user presses that tab.