Search code examples
javaswingjoptionpane

How to change a JOptionPane Theme


I want to make a simple JOptionPane but don't want the Java buttons/icon theme instead would like the windows button/icon. Now can I change it to the windows theme?


Solution

  • Components are created using the current LAF. No guarantee that it will work but you can do something like:

    1. save current LAF
    2. set LAF to Windows
    3. display JOptionPane
    4. restore LAF to saved LAF

    See How to Set the Look and Feel for more information.