JOptionPane.showConfirmDialog: Tabbing between options creates wrong result

In JOptionPane.showConfirmDialog, when pressing <tab> to move between options and then pressing <Enter> I always get a returned zero (0) no matter which button is in focus. Is this a (known) bug or am I stupid?

I run the following code.

import javax.swing.*;

public class TabOptions

{

public static void main (String [] args)

{

int n = JOptionPane.showConfirmDialog (null, "Use <Tab> to shift option-button, then press <Enter>. " +

"I'll write the returned value to sdt out.");

System.out.println ("Returned value: " + n);

}

}

[625 byte] By [Jonas.Edlunda] at [2007-10-3 9:47:36]
# 1

import javax.swing.*;

class TabOptions

{

public static void main (String [] args)

{

UIManager.put("Button.defaultButtonFollowsFocus", Boolean.TRUE);//<--

int n = JOptionPane.showConfirmDialog (null, "Use <Tab> to shift option-button, then press <Enter>. " +

"I'll write the returned value to sdt out.");

System.out.println ("Returned value: " + n);

}

}

Michael_Dunna at 2007-7-15 5:04:40 > top of Java-index,Desktop,Core GUI APIs...