// CbScrollbar.java // A drop-in replacement for the AWT scrollbar class, with callbacks // and a nicer look. This scrollbar is typically used to display some // fraction of a list of items, with values ranging from min to max. // The lvisible parameter determines how many of the list are lvisible // at any one time. The value of the scrollbar ranges from min to // max-lvisible+1 (the highest position in the list to start displaying) import java.awt.*; public class CbScrollbar extends Panel { static final int VERTICAL = 0; static final int HORIZONTAL = 1; CbScrollbarCallback callback; // who to call back to boolean inside, indent; int orient; // horizontal or vertical? int value; // position int lvisible; // the number of lines lvisible int num; // total number of lines int lineinc = 1; // how much the arrow buttons move by Color lc1 = Util.light_edge, lc2 = Util.body, lc3 = Util.dark_edge; Color hc1 = Util.light_edge_hi, hc2 = Util.body_hi, hc3 = Util.dark_edge_hi; Color bc = Util.dark_bg; int y1, y2, x1, x2, drag; CbScrollbarArrow arrow1, arrow2; CbScrollbar(int o, CbScrollbarCallback cb) { this(o, 0, 1, 1, cb); } /**Create a new scrollbar */ CbScrollbar(int o, int v, int vis, int n, CbScrollbarCallback cb) { setValues(v, vis, n); orient = o; callback = cb; setLayout(null); if (orient == VERTICAL) { add(arrow1 = new CbScrollbarArrow(this, 0)); add(arrow2 = new CbScrollbarArrow(this, 1)); } else { add(arrow1 = new CbScrollbarArrow(this, 2)); add(arrow2 = new CbScrollbarArrow(this, 3)); } } /**Set the current scrollbar parameters * @param v Current position * @param vis Number of lines lvisible * @param n Total number of lines */ public void setValues(int v, int vis, int n) { value = v; lvisible = vis; num = n; if (lvisible > num) lvisible = num; checkValue(); repaint(); } public int getValue() { return value; } public void setValue(int v) { value = v; checkValue(); repaint(); } private void checkValue() { if (value < 0) value = 0; else if (value > num-lvisible) value = num-lvisible; } public void paint(Graphics g) { if (num == 0) return; int w = size().width, h = size().height; boolean ins = inside && !(arrow1.inside || arrow2.inside); Color c1 = ins ? hc1 : lc1, c2 = ins ? hc2 : lc2, c3 = ins ? hc3 : lc3; g.setColor(bc); g.fillRect(0, 0, w, h); g.setColor(c3); g.drawLine(0, 0, w-1, 0); g.drawLine(0, 0, 0, h-1); g.setColor(c1); g.drawLine(w-1, h-1, w-1, 0); g.drawLine(w-1, h-1, 0, h-1); if (orient == VERTICAL) { int va = h-w*2; y1 = w+va*value/num; y2 = w+va*(value+lvisible)/num-1; g.setColor(c2); g.fillRect(1, y1, w-2, y2-y1); g.setColor(indent ? c3 : c1); g.drawLine(1, y1, w-2, y1); g.drawLine(1, y1, 1, y2-1); g.setColor(indent ? c1 : c3); g.drawLine(w-2, y2-1, w-2, y1); g.drawLine(w-2, y2-1, 1, y2-1); if (ins) { g.drawLine(w-3, y2-2, w-3, y1+1); g.drawLine(w-3, y2-2, 2, y2-2); } } else if (orient == HORIZONTAL) { int va = w-h*2; x1 = h+va*value/num; x2 = h+va*(value+lvisible)/num-1; g.setColor(c2); g.fillRect(x1, 1, x2-x1, h-2); g.setColor(indent ? c3 : c1); g.drawLine(x1, 1, x1, h-2); g.drawLine(x1, 1, x2-1, 1); g.setColor(indent ? c1 : c3); g.drawLine(x2-1, h-2, x1, h-2); g.drawLine(x2-1, h-2, x2-1, 1); if (ins) { g.drawLine(x2-2, h-3, x1+1, h-3); g.drawLine(x2-2, h-3, x2-2, 2); } } } /**Called by arrows to move the slider */ void arrowClick(int d) { int oldvalue = value; value += d; checkValue(); if (value != oldvalue) { callback.moved(this, value); repaint(); } } public void reshape(int nx, int ny, int nw, int nh) { super.reshape(nx, ny, nw, nh); if (orient == VERTICAL) { arrow1.reshape(1, 1, nw-2, nw-1); arrow2.reshape(1, nh-nw-1, nw-2, nw-1); } else { arrow1.reshape(1, 1, nh-1, nh-2); arrow2.reshape(nw-nh-1, 1, nh-1, nh-2); } repaint(); } public Dimension preferredSize() { return orient==VERTICAL ? new Dimension(16, 100) : new Dimension(100, 16); } public Dimension minimumSize() { return preferredSize(); } public boolean mouseDown(Event e, int mx, int my) { if (orient == VERTICAL) { // move up/down one page, or start dragging if (my < y1) arrowClick(-lvisible); else if (my > y2) arrowClick(lvisible); else { indent = true; drag = my-y1; repaint(); } } else { // move left/right one page, or start dragging if (mx < x1) arrowClick(-lvisible); else if (mx > x2) arrowClick(lvisible); else { indent = true; drag = mx-x1; repaint(); } } return true; } public boolean mouseDrag(Event e, int mx, int my) { if (indent) { int w = size().width, h = size().height; int oldvalue = value; if (orient == VERTICAL) { int va = h-w*2, ny = my-drag-w; value = ny*num/va; } else { int va = w-h*2, nx = mx-drag-h; value = nx*num/va; } checkValue(); if (value != oldvalue) { callback.moving(this, value); repaint(); } } return indent; } public boolean mouseUp(Event e, int mx, int my) { if (indent) { indent = false; repaint(); callback.moved(this, value); return true; } return false; } /* public boolean mouseEnter(Event e, int mx, int my) { inside = true; repaint(); return true; } public boolean mouseExit(Event e, int mx, int my) { inside = false; repaint(); return true; } */ } class CbScrollbarArrow extends Canvas implements Runnable { int mode; CbScrollbar scrollbar; boolean inside, indent; Thread th; CbScrollbarArrow(CbScrollbar p, int m) { scrollbar = p; mode = m; } public void paint(Graphics g) { int w = size().width, h = size().height; Color c1 = inside ? scrollbar.hc1 : scrollbar.lc1, c2 = inside ? scrollbar.hc2 : scrollbar.lc2, c3 = inside ? scrollbar.hc3 : scrollbar.lc3; g.setColor(scrollbar.bc); g.fillRect(0, 0, w, h); int xp[] = new int[3], yp[] = new int[3]; // blank, dark, light if (mode == 0) { // up arrow xp[0] = w/2; xp[1] = w-1; xp[2] = 0; yp[0] = 0; yp[1] = h-1; yp[2] = h-1; } else if (mode == 1) { // down arrow xp[0] = 0; xp[1] = w/2; xp[2] = w-1; yp[0] = 0; yp[1] = h-1; yp[2] = 0; } else if (mode == 2) { // left arrow xp[0] = 0; xp[1] = w-1; xp[2] = w-1; yp[0] = h/2; yp[1] = h-1; yp[2] = 0; } else if (mode == 3) { // right arrow xp[0] = 0; xp[1] = w-1; xp[2] = 0; yp[0] = 0; yp[1] = h/2; yp[2] = h-1; } g.setColor(c2); g.fillPolygon(xp, yp, 3); g.setColor(indent ? c1 : c3); g.drawLine(xp[1], yp[1], xp[2], yp[2]); g.setColor(indent ? c3 : c1); g.drawLine(xp[0], yp[0], xp[2], yp[2]); } public boolean mouseDown(Event e, int mx, int my) { indent = true; repaint(); (th = new Thread(this)).start(); return true; } public boolean mouseUp(Event e, int mx, int my) { indent = false; repaint(); if (th != null) th.stop(); return true; } /**Thread for doing repeated scrolling */ public void run() { int stime = 500; while(true) { scrollbar.arrowClick(mode%2 == 0 ? -1 : 1); try { Thread.sleep(stime); } catch(Exception e) { } stime = 100; } } } // CbScrollbarCallback // Methods for reporting the movement of the scrollbar to another object interface CbScrollbarCallback { /**Called when the scrollbar stops moving. This happens when an * arrow is clicked, the scrollbar is moved by a page, or the user * lets go of the scrollbar after dragging it. * @param sb The scrollar that has been moved * @param v The new value */ void moved(CbScrollbar sb, int v); /**Called upon every pixel movement of the scrollbar when it is * being dragged, but NOT when moved() is called. * @param sb The scrollar that has been moved * @param v The new value */ void moving(CbScrollbar sb, int v); }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
help | Folder | 0755 |
|
|
images | Folder | 0755 |
|
|
lang | Folder | 0755 |
|
|
BorderPanel.class | File | 1.73 KB | 0644 |
|
BorderPanel.java | File | 1.02 KB | 0644 |
|
CHANGELOG | File | 1.58 KB | 0644 |
|
CbButton.class | File | 4.68 KB | 0644 |
|
CbButton.java | File | 5.31 KB | 0644 |
|
CbButtonCallback.class | File | 137 B | 0644 |
|
CbButtonGroup.class | File | 675 B | 0644 |
|
CbScrollbar.class | File | 4.2 KB | 0644 |
|
CbScrollbar.java | File | 7.62 KB | 0644 |
|
CbScrollbarArrow.class | File | 1.9 KB | 0644 |
|
CbScrollbarCallback.class | File | 164 B | 0644 |
|
LineInputStream.class | File | 1.74 KB | 0644 |
|
LineInputStream.java | File | 2.08 KB | 0644 |
|
Makefile | File | 67 B | 0644 |
|
MultiColumn.class | File | 9.55 KB | 0644 |
|
MultiColumn.java | File | 12.55 KB | 0644 |
|
MultiColumnCallback.class | File | 200 B | 0644 |
|
StringJoiner.class | File | 783 B | 0644 |
|
StringSplitter.class | File | 1.2 KB | 0644 |
|
StringSplitter.java | File | 2.02 KB | 0644 |
|
Tracer.class | File | 3.99 KB | 0644 |
|
Tracer.java | File | 2.98 KB | 0644 |
|
Util.class | File | 4.34 KB | 0644 |
|
Util.java | File | 3.15 KB | 0644 |
|
acl_security.pl | File | 1.53 KB | 0755 |
|
cgi_args.pl | File | 280 B | 0755 |
|
config-ALL-linux | File | 84 B | 0644 |
|
config-aix | File | 83 B | 0644 |
|
config-freebsd | File | 86 B | 0644 |
|
config-hpux | File | 83 B | 0644 |
|
config-irix | File | 83 B | 0644 |
|
config-macos | File | 84 B | 0644 |
|
config-netbsd | File | 86 B | 0644 |
|
config-openbsd | File | 86 B | 0644 |
|
config-openserver | File | 83 B | 0644 |
|
config-osf1 | File | 82 B | 0644 |
|
config-solaris | File | 83 B | 0644 |
|
config-unixware | File | 83 B | 0644 |
|
config-windows | File | 86 B | 0644 |
|
config.info | File | 512 B | 0644 |
|
config.info.ca | File | 635 B | 0644 |
|
config.info.cs | File | 555 B | 0644 |
|
config.info.de | File | 509 B | 0644 |
|
config.info.es | File | 341 B | 0644 |
|
config.info.fa | File | 679 B | 0644 |
|
config.info.fr | File | 382 B | 0644 |
|
config.info.hu | File | 521 B | 0644 |
|
config.info.it | File | 576 B | 0644 |
|
config.info.ja | File | 553 B | 0644 |
|
config.info.nl | File | 513 B | 0644 |
|
config.info.no | File | 513 B | 0644 |
|
config.info.pl | File | 517 B | 0644 |
|
config.info.pt_BR | File | 486 B | 0644 |
|
config.info.ru | File | 891 B | 0644 |
|
config.info.sv | File | 320 B | 0644 |
|
config.info.tr | File | 570 B | 0644 |
|
config.info.uk | File | 759 B | 0644 |
|
config.info.zh | File | 253 B | 0644 |
|
config.info.zh_TW | File | 303 B | 0644 |
|
cpan_modules.pl | File | 73 B | 0755 |
|
defaultacl | File | 38 B | 0644 |
|
edit_proc.cgi | File | 4.17 KB | 0755 |
|
freebsd-lib.pl | File | 4.5 KB | 0755 |
|
hpux-lib.pl | File | 2.62 KB | 0755 |
|
index.cgi | File | 466 B | 0755 |
|
index_cpu.cgi | File | 1.3 KB | 0755 |
|
index_run.cgi | File | 1.07 KB | 0755 |
|
index_search.cgi | File | 6.48 KB | 0755 |
|
index_size.cgi | File | 1.26 KB | 0755 |
|
index_tree.cgi | File | 1.5 KB | 0755 |
|
index_user.cgi | File | 1.11 KB | 0755 |
|
index_zone.cgi | File | 1.34 KB | 0755 |
|
kill_proc.cgi | File | 738 B | 0755 |
|
kill_proc_list.cgi | File | 860 B | 0755 |
|
killtail.cgi | File | 316 B | 0755 |
|
linux-lib.pl | File | 18.45 KB | 0755 |
|
log_parser.pl | File | 1.05 KB | 0755 |
|
macos-lib.pl | File | 4.45 KB | 0755 |
|
module.info | File | 289 B | 0644 |
|
module.info.af | File | 0 B | 0644 |
|
module.info.af.auto | File | 119 B | 0644 |
|
module.info.ar | File | 0 B | 0644 |
|
module.info.ar.auto | File | 163 B | 0644 |
|
module.info.be | File | 0 B | 0644 |
|
module.info.be.auto | File | 213 B | 0644 |
|
module.info.bg | File | 0 B | 0644 |
|
module.info.bg.auto | File | 226 B | 0644 |
|
module.info.ca | File | 118 B | 0644 |
|
module.info.ca.auto | File | 28 B | 0644 |
|
module.info.cs | File | 28 B | 0644 |
|
module.info.cs.auto | File | 112 B | 0644 |
|
module.info.da | File | 0 B | 0644 |
|
module.info.da.auto | File | 119 B | 0644 |
|
module.info.de | File | 96 B | 0644 |
|
module.info.de.auto | File | 23 B | 0644 |
|
module.info.el | File | 0 B | 0644 |
|
module.info.el.auto | File | 217 B | 0644 |
|
module.info.es | File | 26 B | 0644 |
|
module.info.es.auto | File | 101 B | 0644 |
|
module.info.eu | File | 0 B | 0644 |
|
module.info.eu.auto | File | 145 B | 0644 |
|
module.info.fa | File | 0 B | 0644 |
|
module.info.fa.auto | File | 230 B | 0644 |
|
module.info.fi | File | 0 B | 0644 |
|
module.info.fi.auto | File | 127 B | 0644 |
|
module.info.fr | File | 34 B | 0644 |
|
module.info.fr.auto | File | 123 B | 0644 |
|
module.info.he | File | 0 B | 0644 |
|
module.info.he.auto | File | 171 B | 0644 |
|
module.info.hr | File | 0 B | 0644 |
|
module.info.hr.auto | File | 132 B | 0644 |
|
module.info.hu | File | 25 B | 0644 |
|
module.info.hu.auto | File | 109 B | 0644 |
|
module.info.it | File | 31 B | 0644 |
|
module.info.it.auto | File | 105 B | 0644 |
|
module.info.ja | File | 27 B | 0644 |
|
module.info.ja.auto | File | 154 B | 0644 |
|
module.info.ko | File | 34 B | 0644 |
|
module.info.ko.auto | File | 127 B | 0644 |
|
module.info.lt | File | 0 B | 0644 |
|
module.info.lt.auto | File | 147 B | 0644 |
|
module.info.lv | File | 0 B | 0644 |
|
module.info.lv.auto | File | 131 B | 0644 |
|
module.info.ms | File | 120 B | 0644 |
|
module.info.ms.auto | File | 24 B | 0644 |
|
module.info.mt | File | 0 B | 0644 |
|
module.info.mt.auto | File | 147 B | 0644 |
|
module.info.nl | File | 27 B | 0644 |
|
module.info.nl.auto | File | 90 B | 0644 |
|
module.info.no | File | 28 B | 0644 |
|
module.info.no.auto | File | 95 B | 0644 |
|
module.info.pl | File | 29 B | 0644 |
|
module.info.pl.auto | File | 108 B | 0644 |
|
module.info.pt | File | 27 B | 0644 |
|
module.info.pt.auto | File | 107 B | 0644 |
|
module.info.pt_BR | File | 0 B | 0644 |
|
module.info.pt_BR.auto | File | 148 B | 0644 |
|
module.info.ro | File | 0 B | 0644 |
|
module.info.ro.auto | File | 138 B | 0644 |
|
module.info.ru | File | 25 B | 0644 |
|
module.info.ru.auto | File | 179 B | 0644 |
|
module.info.sk | File | 0 B | 0644 |
|
module.info.sk.auto | File | 133 B | 0644 |
|
module.info.sl | File | 0 B | 0644 |
|
module.info.sl.auto | File | 126 B | 0644 |
|
module.info.sv | File | 25 B | 0644 |
|
module.info.sv.auto | File | 91 B | 0644 |
|
module.info.th | File | 0 B | 0644 |
|
module.info.th.auto | File | 325 B | 0644 |
|
module.info.tr | File | 30 B | 0644 |
|
module.info.tr.auto | File | 123 B | 0644 |
|
module.info.uk | File | 0 B | 0644 |
|
module.info.uk.auto | File | 217 B | 0644 |
|
module.info.ur | File | 0 B | 0644 |
|
module.info.ur.auto | File | 193 B | 0644 |
|
module.info.vi | File | 0 B | 0644 |
|
module.info.vi.auto | File | 168 B | 0644 |
|
module.info.zh | File | 24 B | 0644 |
|
module.info.zh.auto | File | 91 B | 0644 |
|
module.info.zh_TW | File | 30 B | 0644 |
|
module.info.zh_TW.auto | File | 97 B | 0644 |
|
open_files.cgi | File | 2.57 KB | 0755 |
|
openbsd-lib.pl | File | 1.81 KB | 0755 |
|
osf-lib.pl | File | 2.44 KB | 0755 |
|
prefs.info | File | 53 B | 0644 |
|
proc-lib.pl | File | 15.8 KB | 0755 |
|
rbac-mapping | File | 126 B | 0644 |
|
renice_proc.cgi | File | 617 B | 0755 |
|
run.cgi | File | 1.38 KB | 0755 |
|
safeacl | File | 35 B | 0644 |
|
syslog_logs.pl | File | 336 B | 0755 |
|
sysv-lib.pl | File | 6.12 KB | 0755 |
|
tail.cgi | File | 750 B | 0755 |
|
trace.cgi | File | 2.4 KB | 0755 |
|
windows-lib.pl | File | 1.25 KB | 0755 |
|