Article View: borland.public.jbuilder.java.swing
Article #13266How to change the TAB order of swing components, a possible workaround
From: Martin Anders
Date: Thu, 27 Aug 1998 00:00
Date: Thu, 27 Aug 1998 00:00
38 lines
2162 bytes
2162 bytes
Just in case somebody has the same problem, finally I've found a workaround: Though I don't know how the swing FocusManager works (and I find no clues within the code generated by JBuilder where this order is set) you can use the AWT FocusManager instead, even for Swing components. Therefore you have to disable the SwingFocusManager by adding the following line to your source: com.sun.java.swing.FocusManager.disableSwingFocusManager(); (don't forget to import the swing package). A good place might be the constructor of your GUI Class or you can place it within the jbInit() function usually generated by JBuilder. Now you can use the TAB order of the AWT FocusManager. The AWT Focusmanager is now enabled and uses the order you added components to a container. Assume we have three text fields: jTextfield1,jTextField2 and jTextField3. by adding these text fields to a container: myjPanel.add(jTextField1); myjPanel.add(jTextField2); myjPanel.add(jTextField3); you got the following TAB order: jTextField1 --> jTextField2 --> jTextField3 Changing the code to: myjPanel.add(jTextField2); myjPanel.add(jTextField3); myjPanel.add(jTextField1); gave you this TAB order: jTextField2 --> jTextField3 --> jTextField1 Perhaps not a elegant way but it helps if you created a complex GUI with the GUI Builder (adding and deleting numerous components) and at the end you find out...oooppps...the TAB order is somehow wrong. Just change the order of the adding entries in the jbInit function to fix it. Martin
Technical Details
Message-ID:
<35E53216.E049A12D@ddsynergy.de>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<35DBEA06.18E194C@ddsynergy.de> <6rqjkd$c9q9@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,5505e1209065c490 X-Google-Attributes: gid111d45,public From: Martin Anders <m_anders@ddsynergy.de> Subject: How to change the TAB order of swing components, a possible workaround Date: 1998/08/27 Message-ID: <35E53216.E049A12D@ddsynergy.de> X-Deja-AN: 385227803 Content-Transfer-Encoding: 7bit References: <35DBEA06.18E194C@ddsynergy.de> <6rqjkd$c9q9@forums.borland.com> Content-Type: text/plain; charset=us-ascii Organization: Another Netscape Collabra Server User Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing