Search code examples
javaswinglook-and-feeljprogressbar

Changing Swing progress bar look and feel


I keep trying to chang the UIManager to make these stupid looking green squares go away. how do i change the look and feel of this to the user? Is it system dependent? Someone else who was compiling my code had a constant gradient. Ideally, it would just be a solid square, as opposed to smaller blocks.

Thanks

enter image description here


Solution

  • Have you tried setting it to the system's (user's) look and feel?

    The easiest way to set the look and feel is by launching the GUI after calling:

    try
    {
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    }
    catch (Exception e)
    {
        // ...
    }
    

    With that said, the above appears to be the Windows XP theme and may indeed be the system (user) theme. I generally stay away from custom themes in GUIs unless there is a very good reason (e.g., customer/user requirement).

    That is to say, the above code makes it system dependent, which is good because it matches the user's expecations.