Event Queuing to get focus

15 Jun

You might need to do something like this if you want a component to get Focus but it has not been drawn yet (you can Focus on an undrawn/invisible component)


        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                Component compFocusOwner =

                  // null is returned if none of the windows in this application has the focus
                  Window windowFocusOwner =


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: