Component « Focus « Java Swing Q&A





1. how is the container component    stackoverflow.com

hello all i have an application with two main panel LEFT and RIGHT when a component got focus i want to know how is the container that holds that component (LEFT or ...

2. Request Focus for component in nested Swing layout    stackoverflow.com

I'd like to be able to jump from one part of my Java/Swing application to another by a simple button click. What I try to achieve is to implement a global ...

3. AWT Canvas cannot gain focus in the presence of another focusable component    stackoverflow.com

I have a simple GUI with a JTextField and an AWT Canvas (to prevent the counter-question as to why I'm using an AWT Canvas: I need to have a window handle). The ...

4. I need example of multi focus to more than one component in swing    forums.netbeans.org

I have a problem in case I want to focus more than component to execute single action to them. I need also to get which keypressed on window in focusGained of component specefic compoent Thanks for all

6. When the focus is on a component....    coderanch.com

7. Focus for a component    coderanch.com

hi, I found that at JGuru: "The requestFocus() method will only work when the component is visible so ensure that your window/applet is visible and that your component has been added to it. Then call the requestFocus() method on the component to switch the focus." i've seen in the API a method setInitialFocus(). Maybe that will work?! chantal

8. setting focus on a component    coderanch.com





10. Set focus to a component.    coderanch.com

this is from the api, and could be the explanation of your 'undesirable results' "public void requestFocus() ... Because the focus behavior of this method is platform-dependent, developers are strongly encouraged to use requestFocusInWindow when possible." as for it not working, the component must be visible prior to calling requestFocus() i.e. the end of your GUI constructor would look something like ...

11. How to know which component has the current focus    coderanch.com

Hi, everybody! I have a frame which contains 2 jpanels (masterPanel and detailPanel). In masterPanel i have 5 jtextfields (jtxtField1...jtxtField5) and in detailPanel i also have 5 jtextfields (jtxtField6...jtxtField10). I have 2 questions regarding this scenario. 1. How will i know which among the jtextfields has the focus currently? To which component will i attach the proper listener? 2. Is it ...

13. How can I keep focus on the component pressed until I pressed other component????    coderanch.com

Dear Friends: I met an urgent problem in my project,How can I keep focus on the component pressed until I pressed other component?? ie. here in following code, I pressed jlabel jl1, then jl1 was highlighted and showed red border line, when i move out of this jl1 to other place, but I pressed nothing, then the focus on jl1 was ...

14. focus selection of components    coderanch.com

I need to create a chassis view component. In such a case i will have a component that will represent a network card and some components withint that card. Now when using i should be able to select the card or the specific component within it. Whatever element it is, the selection should be visible in the frame... ie if i ...

16. Last focused component    java-forums.org

Dear All, Kindly solve my problem. I am very puzzled about it. My Problem is Simple: How to get last focus owner component? e.g. we are at bttnSave (or else) and then click on a text field txtName. I want to get component that was owned focus before getting focus in text field. So I hope, now you understand my problem. ...





17. Scrolling to focused component    java-forums.org

18. focus on a specific component    java-forums.org

Hi, i meant a "JToolBar". Here is a short,self contained example of what I mean. There are two classes: MainView and ViewBoard. The MainView contains the main, so you can copy paste this two classes and run it to see what I mean. Class MainView: Java Code: package view; import java.awt.BorderLayout; import javax.swing.JPanel; import javax.swing.JFrame; import javax.swing.JToolBar; import javax.swing.JButton; import javax.swing.SwingUtilities; ...