mgarin / weblaf

WebLaF is a fully open-source Look & Feel and component library written in pure Java for cross-platform desktop Swing applications.
http://weblookandfeel.com
GNU General Public License v3.0
1.15k stars 235 forks source link

Custom painters are not properly applied #450

Closed mgarin closed 6 years ago

mgarin commented 7 years ago

Here is a small code sample representing the issue:

public class CustomPainter
{
    public static void main ( final String[] args )
    {
        WebLookAndFeel.install ();

        final WebPanel panel = new WebPanel ( new WebLabel ( "Sample content" ) );
        final TitledBorderPainter painter = new TitledBorderPainter ( "Sample title" );
        painter.setColor ( Color.RED );
        panel.setCustomPainter ( painter );

        TestFrame.show ( panel, 25 );
    }
}

However painter is partially applied if skin is changed or reloaded. For example calling this:

StyleManager.setSkin ( WebSkin.class );

After adding the painter into the component will display it, but won't adjust component borders properly.

mgarin commented 7 years ago

Along with fixing this particular problem I will be removing some deprecated parts of the StyleManager that allowed multiple painters per component (do not confuse component painters or SpecificPainters with SectionPainters - you can still have multiple SectionPainters).

mgarin commented 6 years ago

This have been fixed in the recent commit. Custom painters should now be properly applied and should also properly update component's view. I have also fixed a few issues related to custom painter border calculations.