List of usage examples for javax.swing JScrollBar isEnabled
public boolean isEnabled()
From source file:Main.java
@Override protected void paintThumb(Graphics g, JComponent c, Rectangle r) { Graphics2D g2 = (Graphics2D) g.create(); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); Color color = null;/*from www .ja v a 2 s . c om*/ JScrollBar sb = (JScrollBar) c; if (!sb.isEnabled() || r.width > r.height) { return; } else if (isDragging) { color = Color.DARK_GRAY; } else if (isThumbRollover()) { color = Color.LIGHT_GRAY; } else { color = Color.GRAY; } g2.setPaint(color); g2.fillRoundRect(r.x, r.y, r.width, r.height, 10, 10); g2.setPaint(Color.WHITE); g2.drawRoundRect(r.x, r.y, r.width, r.height, 10, 10); g2.dispose(); }