Control « Focus « Java Swing Q&A





1. Is there an easy way to change the behavior of a Java/Swing control when it gets focus?    stackoverflow.com

For most GUI's I've used, when a control that contains text gets the focus, the entire contents of the control are selected. This means if you just start typing, you ...

2. Customizing FocusTraversalPolicy for JFrame with GridBagLayout    stackoverflow.com

I have a JFrame with four components: three JPanels and a JTabbedPane. Two panels have selectable components and are located approximately in BorderLayout.NORTH and EAST, while the JTabbedPane sits approximately ...

3. Making control have initial focus    coderanch.com

4. Choosing which control has focus    coderanch.com

Thanks for the suggestion. There are a couple of problems here. First of all, it is considered bad practice to create public member fields like gui.button and gui.logica in your example. Second, when I write GUI programs, I typically only have one line in main(): new MyFrame().setVisible(true); Then the MyFrame class typically creates a menu and a MyPanel (for example). The ...

7. how to change the focus the control    coderanch.com