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.13k stars 234 forks source link

The scroll bar is not drawn,How do I set him up? #683

Closed xcfdszzr closed 2 years ago

xcfdszzr commented 2 years ago
        final JScrollPane scrollPane = new JScrollPane ();
        scrollPane.putClientProperty ( StyleId.STYLE_PROPERTY,  StyleId.scrollpaneTransparentHovering );
        scrollPane.setPreferredSize ( new Dimension ( 200, 160 ) );
        WebPanel webPanel = new WebPanel(new LineLayout(LineLayout.VERTICAL));
        for (int i = 0; i < 100; i++) {
            webPanel.add(new WebLabel("11111"));
        }
        scrollPane.setViewportView(webPanel);

image

When I add a component, the scrollbar becomes undrawable or the drawing is dirty

mgarin commented 2 years ago

This happens because the WebPanel you add into scroll pane is opaque. If you want any component to hover over other one without visual glitches like on your screenshot - that other component needs to be non-opaque, otherwise repaint calls will not make it past that other component when necessary.

xcfdszzr commented 2 years ago

This happens because the WebPanel you add into scroll pane is opaque. If you want any component to hover over other one without visual glitches like on your screenshot - that other component needs to be non-opaque, otherwise repaint calls will not make it past that other component when necessary.

Thank you author, my problem has been solved