Color of JOptionPane border
Asked Answered
P

3

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

Proboscidean answered 3/7, 2013 at 15:36 Comment(0)
I
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

Improbable answered 3/7, 2013 at 15:44 Comment(1)
Perfect, didn't know that was possible. Thank you.Proboscidean
H
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));
Headrick answered 24/9, 2015 at 2:26 Comment(2)
Can you provide an explanation to the code? It might help OP or future users more that way.Borgeson
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.Headrick
D
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

Deceit answered 3/1, 2019 at 15:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.