@Override protected void paintBackground(Graphics g, JComponent component) { getGlassParameters(); Graphics2D g2d = (Graphics2D) g.create(); if (getOrientation().isHorizontal()) { paintBackground( g2d, 0, 0, component.getWidth(), component.getHeight(), getOrientation().isHorizontal(), component); } else { paintBackground( g2d, 0, 0, component.getHeight(), component.getWidth(), getOrientation().isHorizontal(), component); } g2d.dispose(); }
@Override protected void paintForeground(Graphics g, JComponent component) { // paint icon (if there is any) paintIcon(g, component); Insets ins = getOutsideInsets(); int w = component.getWidth(); int h = component.getHeight(); // paint knob (if there is any) // TODO colors if (behavior.isShowKnob()) { Insets insets = getInnerInsets(); if (getOrientation().isHorizontal()) { int x = ins.left + insets.left - KNOB_SIZE + 3; int y1 = ins.top + insets.top + 3; int y2 = h - insets.bottom - ins.bottom - 4; g.setColor(Color.WHITE); g.drawLine(x, y1, x, y2); g.drawLine(x, y1, x + 1, y1); g.setColor(Color.DARK_GRAY); g.drawLine(x, y2, x + 1, y2); g.drawLine(x + 1, y1 + 1, x + 1, y2); } else { int y = ins.top + insets.top - KNOB_SIZE + 3; int x1 = ins.left + insets.left + 3; int x2 = w - insets.right - ins.right - 4; g.setColor(Color.WHITE); g.drawLine(x1, y, x2, y); g.drawLine(x1, y, x1, y + 1); g.setColor(Color.DARK_GRAY); g.drawLine(x1 + 1, y + 1, x2, y + 1); g.drawLine(x2, y, x2, y + 1); } } }