Object[] options = {"questions", "list"};
Object selection = JOptionPane.showOptionDialog(Main.mWindow, "newDocText", "newDoc",
JOptionPane.OK_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]);
I use the above code to create a JOptionPane.
Focus is painted on primary selected option, but I’d like to hide it completley. Is that possible?
For me the answer of David Kroukamp still results in the first button focused, probably because there must be always a component with focus. The following code explicitly gives the focus to a JLabel:
EDIT: If only the painting of the focus is a problem, you can pass JButtons to JOptionPane, after you called setFocusPainted(false) on them. You can do it like this:
But in this case you need to set up the closing of the dialog yourself. I think this is the more complicated solution.