0

How might I go about changing the color of a JOptionPane's border?

Here is a screenshot of the border I am talking about:

enter image description here

That blue border is what I am trying to get rid of.

I tried to set UIManager.put("OptionPane.border", new BorderFactory...)for LookAndFeel but that changed the inside border, not the outermost one.

I need to get rid of that blue border.

Any ideas?

-Mark

Tamara Koliada
  • 1,200
  • 2
  • 14
  • 31
Mark
  • 418
  • 1
  • 4
  • 13

3 Answers3

2

Read the JOptionPane API. It shows you how to create a JOption pane manually so that you have access to the JDialog. Once you have the JDialog you can remove the Border the same way you did in your last question:

Undecorated JDialog border

Community
  • 1
  • 1
camickr
  • 321,443
  • 19
  • 166
  • 288
0

I have research on it these days, finally I found this code may help you!

UIManager.put("RootPane.frameBorder", new LineBorder(Color.red));
UIManager.put("RootPane.dialogBorder", new LineBorder(Color.red));    
UIManager.put("RootPane.errorDialogBorder", new LineBorder(Color.red));
Jun
  • 1
  • 3
  • Can you provide an explanation to the code? It might help OP or future users more that way. – Bono Sep 24 '15 at 08:40
  • I read the source code of alloy.jar whose JOptionPane border color is always red for error or yellow for warning. These codes tell us how to change the color of it. – Jun Dec 15 '15 at 02:37
0

In LaF section there is the initialization of ShadowPopupBorder which used for tooltips, popups, and modal dialogs borders. So check if it is used around your software

Tamara Koliada
  • 1,200
  • 2
  • 14
  • 31