Java – how do I change the background color of jooptionpane?

I've added joptionpane to my application, but I don't know how to change the background color to white@ H_ 301_ 2@`int option = JOptionPane. showConfirmDialog(bcfiDownloadPanel,new Object[]{"Host: " + source,panel},"Authorization required",JOptionPane.OK_CANCEL_OPTION,JOptionPane.PLAIN_MESSAGE ); if (option == JOptionPane.OK_OPTION) { }`

Solution

By using uimanager class @ h_ 301_ 2@import javax. swing. UIManager; UIManager UI=new UIManager(); UI. put("OptionPane.background",new ColorUIResource(255,0)); UI. put("Panel.background",0));

or

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>