boolean (Graphics g, int clipx, int clipy, int clipwidth, int clipheight, Rectangle bounds, Rectangle view, Rectangle viewport, boolean enabled, boolean inside, boolean pressed) { if ((viewport.y + viewport.height < bounds.height) && (clipy + clipheight > viewport.y + viewport.height)) { // need horizontal int x = viewport.x; int y = viewport.y + viewport.height; int height = bounds.height - y; int button = Math.min(block, viewport.width / 2); int track = viewport.width - (2 * button); //max 10 int knob = Math.min(track, Math.max(track * (viewport.width - 2) / view.width, 6)); int decrease = view.x * (track - knob) / (view.width - viewport.width + 2); int increase = track - decrease - knob; paintArrow(g, x, y, button, height, 'W', enabled, inside, pressed, "left", false, true, true, false); paintRect(g, x + button, y, decrease, height, enabled ? c_border : c_disable, c_bg, false, true, true, false); paintRect(g, x + button + decrease, y, knob, height, enabled ? c_border : c_disable, enabled ? c_ctrl : c_bg, false, true, true, true); int n = Math.min(5, (knob - 4) / 3); g.setColor(enabled ? c_border : c_disable); int cx = (x + button + decrease) + (knob + 2 - n * 3) / 2; for (int i = 0; i < n; i++) { g.drawLine(cx + i * 3, y + 2, cx + i * 3, y + height - 4); } paintRect(g, x + button + decrease + knob, y, increase, height, enabled ? c_border : c_disable, c_bg, false, false, true, true); paintArrow(g, x + button + track, y, button, height, 'E', enabled, inside, pressed, "right", false, false, true, true); } if ((viewport.x + viewport.width < bounds.width) && (clipx + clipwidth > viewport.x + viewport.width)) { // need vertical int x = viewport.x + viewport.width; int y = viewport.y; int width = bounds.width - x; //if (y > 0) { // paintRect(g, x - 1, 0, width + 1, y, // enabled ? c_border : c_disable, c_bg, false, true, false, false); //} int track = viewport.height - (2 * block); int knob = track * (viewport.height - 2) / view.height; int decrease = view.y * (track - knob) / (view.height - viewport.height + 2); int increase = track - decrease - knob; paintArrow(g, x, y, width, block, 'N', enabled, inside, pressed, "up", true, false, false, true); paintRect(g, x, y + block, width, decrease, enabled ? c_border : c_disable, c_bg, true, false, false, true); paintRect(g, x, y + block + decrease, width, knob, enabled ? c_border : c_disable, enabled ? c_ctrl : c_bg, true, false, true, true); int n = Math.min(5, (knob - 4) / 3); g.setColor(enabled ? c_border : c_disable); int cy = (y + block + decrease) + (knob + 2 - n * 3) / 2; for (int i = 0; i < n; i++) { g.drawLine(x + 2, cy + i * 3, x + width - 4, cy + i * 3); } paintRect(g, x, y + block + decrease + knob, width, increase, enabled ? c_border : c_disable, c_bg, false, false, true, true); paintArrow(g, x, y + block + track, width, block, 'S', enabled, inside, pressed, "down", false, false, true, true); } if ((clipx + clipwidth > viewport.x) && (clipy + clipheight > viewport.y) && (clipx < viewport.x + viewport.width) && (clipy < viewport.y + viewport.height)) { g.clipRect(viewport.x + 1, viewport.y + 1, viewport.width - 2, viewport.height - 2); g.translate(viewport.x + 1 - view.x, viewport.y + 1 - view.y); return true; } return false; }