void (int x, int y, int width, int height) { // A logic to override Swing's "ScrollBar.alwaysShowThumb" property (set by GTK+ L&F). // When the property is set, the thumb fits entire width/height of a scroll bar (see BasicScrollBarUI.layoutVScrollbar()). // The fix detects such situations and resets thumb size, thus hiding the thumb when not needed. if (width > 0 && height > 0 && UIManager.getBoolean("ScrollBar.alwaysShowThumb") && !alwaysShowTrack()) { int w = trackRect.width, h = trackRect.height; if (w > h && w == width || w < h && h == height) { x = y = width = height = 0; } } if (myRepaintCallback != null) { // We want to repaint whole scrollbar even if thumb wasn't moved (on small scroll of a big panel) // Even if scrollbar wasn't changed itself, myRepaintCallback could need repaint scrollbar.repaint(trackRect); } super.setThumbBounds(x, y, width, height); }