493: Undecipherable

-Blog-

-Projects-

-About me-

-RSS-

JOptionPane and the Focus

Dennis Guse

I started to write a login screen (NEED: two input field [username, password]and two buttons [ok, cancel]). Since a login is a blocking panel I created a JPanel and put that on a JOptionPane.showDialog(…). Everything looked quite fine, but the default focus was set on the OK-Button. So I tried to requestDefaultFocus, but nothing worked. Mark provides a running solution.

And it works!