FocusListener « Focus « Java Swing Q&A





1. how to Override FocusListener - Swing    stackoverflow.com

The application i work with override the default JComboBox from swing. Leets Call it MyComboBox. This version of ComboBox implement the FocusListener and contains the two methods focusGained and ...

2. FocusListener Null Pointer Exception    coderanch.com

Offhand, your code looks reasonable. The exceptions message should come with a stack trace too, which hopefully can identify exactly which line in which file is throwing the exception. You may need to compile using -g to get the most complete info possible here. If you post the exact message that may help - note that the line numbers won't mean ...

3. Platform dependent FocusListener behavior...    coderanch.com

A strange problem cropped up here at work... it has been solved, so no-one should feel pressured to fix it... I was just wondering if anyone else had experienced it, or knew why it was happening, or to help someone out with the solution if it happens to them. A friend of mine here at work was working on validating dates ...

4. FocusListener problem    coderanch.com

Hi, I'm developing a text editor and when it starts,it displays the main window, toolbar and menubar and this is it. When the user create a new file, it creates dynamically a JTextPane on a JScrollPane on a JTabbedPane, it is possible to create as many file as you want and close as well one by one and all of them. ...

5. FocusListener    coderanch.com

6. ask some questions about FocusListener    coderanch.com

JPanels by default are focusable, so either override isFocusable or call setFocusable:import java.awt.event.*; import javax.swing.*; public class JMyPanel extends JPanel{ public JMyPanel(){ setFocusable(true); this.addFocusListener(new FocusListener(){ public void focusGained(FocusEvent e) { System.out.println("have"); } public void focusLost(FocusEvent e) { System.out.println("haven't"); } }); } public static void main(String[] args) { JPanel panel = new JMyPanel(); panel.add(new JLabel("a label")); panel.add(new JButton("a button")); panel.add(new JTextField("a text ...

7. FocusListener    coderanch.com

8. FocusListener problem    coderanch.com

9. FocusListener    coderanch.com

Hello, I have 2 JTextFields(jtf1 and jtf2) and both of them added FocusListener, when jtf1 lose focus, there is a lookup dialog popup and also for jtf2. The problem is that after jtf1 gain focus, and then I click the other fields, for example jtf2, a lookup dialog for jtf1 will pop up. However, after I click "yes" button for the ...





10. PropertyChangeListener - FocusListener - which one do I use    coderanch.com

Dear Ranchers, I have two questions. They are related I think , but I am not sure so I put the other question as a separate topic I have an application which can open and save files. However, when I open up a second file in a new Window and even if I click on the first Window it is only ...

11. Using a FocusListener, How does Java choose when to return or wait for a method call or Thread run?    coderanch.com

I'm using AWT, and specifically a TextField component with an added java.awt.event.FocusListener to receive events when a User focuses in and out of the TextField. This is just an introduction, not my real issue, and the important features of my class is down below if it helps put things into perspective (minus AWT's window close events listener, so you can't close ...

12. Swing components share FocusListener    java-forums.org

Hi All, I've been stumped by a FocusListener problem in Swing. I'm digging through someone else's code and basically, I have a scenario where one component somehow calls the FocusLost of another component (even though the second component never had focus to begin with). Is there a programmatic way to call FocusLost of a component? Eg - can I just invoke ...