How to change background color of JOptionPane?

前端 未结 5 702
走了就别回头了
走了就别回头了 2020-12-09 12:01

I have added JOptionPane to my application but I do not know how to change background color to white?

`int option = JOptionPane.showConfirmDialog(bcfiDownloa         


        
5条回答
  •  一整个雨季
    2020-12-09 12:18

    Use something like this to change the background color just for this one message display and not the whole system...

        Object paneBG = UIManager.get("OptionPane.background");
        Object panelBG = UIManager.get("Panel.background");
        UIManager.put("OptionPane.background", new Color(...));
        UIManager.put("Panel.background", new Color(...));
    
        int ret = messageBox(msg, null, (short)type);
    
        UIManager.put("OptionPane.background", paneBG);
        UIManager.put("Panel.background", panelBG);
    

提交回复
热议问题