void (Graphics g, int clipx, int clipy, int clipwidth, int clipheight, Object component, boolean enabled) { if (!getBoolean(component, "visible", true)) { return; } Rectangle bounds = getRectangle(component, "bounds"); if (bounds == null) { return; } if (bounds.width < 0) { bounds.width = Math.abs(bounds.width); doLayout(component); } if ((clipx + clipwidth < bounds.x) || (clipx > bounds.x + bounds.width) || (clipy + clipheight < bounds.y) || (clipy > bounds.y + bounds.height)) { return; } clipx -= bounds.x; clipy -= bounds.y; String classname = getClass(component); boolean pressed = (mousepressed == component); boolean inside = (mouseinside == component) && ((mousepressed == null) || pressed); boolean focus = focusinside && (focusowner == component); enabled = getBoolean(component, "enabled", true); //enabled && g.translate(bounds.x, bounds.y); //g.setClip(0, 0, bounds.width, bounds.height); if ("label" == classname) { paintContent(component, g, clipx, clipy, clipwidth, clipheight, 0, 0, bounds.width, bounds.height, enabled ? c_text : c_disable, "left", true); } else if ("button" == classname) { paintRect(g, 0, 0, bounds.width, bounds.height, enabled ? c_border : c_disable, enabled ? ((inside != pressed) ? c_hover : (pressed ? c_press : c_ctrl)) : c_bg, true, true, true, true); if (focus) { g.setColor(c_focus); g.drawRect(2, 2, bounds.width - 5, bounds.height - 5); } paintContent(component, g, clipx, clipy, clipwidth, clipheight, 6, 3, bounds.width - 12, bounds.height - 6, enabled ? c_text : c_disable, "center", true); } else if ("checkbox" == classname) { boolean selected = getBoolean(component, "selected", false); String group = getString(component, "group", null); Color border = enabled ? c_border : c_disable; Color foreground = enabled ? ((inside != pressed) ? c_hover : (pressed ? c_press : c_ctrl)) : c_bg; int dy = (bounds.height - block + 2) / 2; if (group == null) { paintRect(g, 1, dy + 1, block - 2, block - 2, border, foreground, true, true, true, true); } else { g.setColor((foreground != c_ctrl) ? foreground : c_bg); g.fillOval(1, dy + 1, block - 3, block - 3); //java g.setColor(border); g.drawOval(1, dy + 1, block - 3, block - 3); //java } if (focus) { g.setColor(c_focus); if (group == null) { g.drawRect(3, dy + 3, block - 7, block - 7); } else { g.drawOval(3, dy + 3, block - 7, block - 7); //java } } if((!selected && inside && pressed) || (selected && (!inside || !pressed))) { g.setColor(enabled ? c_text : c_disable); if (group == null) { g.fillRect(3, dy + block - 9, 2, 6); g.drawLine(3, dy + block - 4, block - 4, dy + 3); g.drawLine(4, dy + block - 4, block - 4, dy + 4); } else { g.fillOval(5, dy + 5, block - 10, block - 10); //java g.drawOval(4, dy + 4, block - 9, block - 9); //java } } paintContent(component, g, clipx, clipy, clipwidth, clipheight, block + 3, 0, bounds.width - block - 3, bounds.height, enabled ? c_text : c_disable, "left", true); } else if ("combobox" == classname) { if (getBoolean(component, "editable", true)) { Image icon = getIcon(component, "icon", null); int left = (icon != null) ? icon.getWidth(this) : 0; paintField(g, clipx, clipy, clipwidth, clipheight, component, bounds.width - block, bounds.height, inside, pressed, focus, enabled, false, left); if (icon != null) { g.drawImage(icon, 2, (bounds.height - icon.getHeight(this)) / 2, this); //java //midp g.drawImage(icon, 2, bounds.height / 2, Graphics.LEFT | Graphics.VCENTER); } paintArrow(g, bounds.width - block, 0, block, bounds.height, 'S', enabled, inside, pressed, "down", true, false, true, true); } else { paintRect(g, 0, 0, bounds.width, bounds.height, enabled ? c_border : c_disable, enabled ? ((inside != pressed) ? c_hover : (pressed ? c_press : c_ctrl)) : c_bg, true, true, true, true); paintContent(component, g, clipx, clipy, clipwidth, clipheight, 2, 2, bounds.width - block - 4, bounds.height - 4, enabled ? c_text : c_disable, "left", false); paintArrow(g, bounds.width - block, 0, block, bounds.height, 'S'); if (focus) { g.setColor(c_focus); g.drawRect(2, 2, bounds.width - block - 5, bounds.height - 5); } } } else if ("combolist" == classname) { Rectangle view = getRectangle(component, ":view"); Rectangle viewport = getRectangle(component, ":port"); g.setColor(c_border); g.drawRect(viewport.x, viewport.y, viewport.width - 1, viewport.height - 1); if (paintScrollPane(g, clipx, clipy, clipwidth, clipheight, bounds, view, viewport, enabled, inside, pressed)) { Object selected = get(component, "inside"); int ly = clipy - viewport.y - 1; int yfrom = view.y + Math.max(0, ly); int yto = view.y + Math.min(viewport.height - 2, ly + clipheight); for (Object choice = get(get(component, "combobox"), "choice"); choice != null; choice = get(choice, ":next")) { Rectangle r = getRectangle(choice, "bounds"); if (yto <= r.y) { break; } if (yfrom >= r.y + r.height) { continue; } boolean armed = (selected == choice); paintRect(g, r.x, r.y, bounds.width - 2, r.height, c_border, armed ? c_select : c_bg, false, false, false, false); paintContent(choice, g, clipx, yfrom, clipwidth, yto - yfrom, r.x + 4, r.y + 2, bounds.width - 10, r.height - 4, getBoolean(choice, "enabled", true) ? c_text : c_disable, "left", false); } resetScrollPane(g, clipx, clipy, clipwidth, clipheight, view, viewport); } //paintRect(g, 0, 0, bounds.width, bounds.height, // secondary1, c_ctrl, true, true, true, true); } else if (("textfield" == classname) || ("passwordfield" == classname)) { paintField(g, clipx, clipy, clipwidth, clipheight, component, bounds.width, bounds.height, inside, pressed, focus, enabled, ("passwordfield" == classname), 0); } else if ("textarea" == classname) { Rectangle view = getRectangle(component, ":view"); Rectangle viewport = getRectangle(component, ":port"); boolean editable = getBoolean(component, "editable", true); paintRect(g, viewport.x, viewport.y, viewport.width, viewport.height, enabled ? c_border : c_disable, editable ? c_textbg : c_bg, true, true, true, true); if (paintScrollPane(g, clipx, clipy, clipwidth, clipheight, bounds, view, viewport, enabled, inside, pressed)) { String text = getString(component, "text", ""); int start = focus ? getInteger(component, "start", 0) : 0; int end = focus ? getInteger(component, "end", 0) : 0; int is = Math.min(start, end); int ie = Math.max(start, end); boolean wrap = getBoolean(component, "wrap", false); FontMetrics fm = g.getFontMetrics(); //java int fontascent = fm.getAscent(); int fontheight = fm.getHeight(); //java //midp int fontheight = fm.getHeight(); int ascent = 1; int ly = clipy - viewport.y - 1; int yfrom = view.y + Math.max(0, ly); int yto = view.y + Math.min(viewport.height - 2, ly + clipheight); //g.setColor(Color.pink); g.fillRect(0, yfrom - 1, 75, 2); g.fillRect(0, yto - 1, 75, 2); boolean prevletter = false; int n = text.length(); char c = 0; for (int i = 0, j = -1, k = 0; k <= n; k++) { // j is the last space index (before k) if (yto <= ascent) { break; } if (wrap) { if (((k == n) || ((c = text.charAt(k)) == '\n') || (c == ' ')) && (j > i) && (fm.stringWidth(text.substring(i, k)) > viewport.width - 4)) { k--; // draw line to the begin of the current word (+ spaces) if it is out of width } else if ((k == n) || (c == '\n')) { // draw line to the text/line end j = k; prevletter = false; } else { if ((c == ' ') && (prevletter || (j > i))) { j = k; } // keep spaces starting the line prevletter = (c != ' '); continue; } } else { if ((k == n) || ((c = text.charAt(k)) == '\n')) { j = k; } else { continue; } } if (yfrom < ascent + fontheight) { String line = (j != -1) ? text.substring(i, j) : text.substring(i); //java if (focus && (is != ie) && (ie >= i) && ((j == -1) || (is <= j))) { int xs = (is < i) ? -1 : (((j != -1) && (is > j)) ? (view.width - 1) : fm.stringWidth(text.substring(i, is))); //java //midp font.substringWidth(text, i, is - i)); int xe = ((j != -1) && (ie > j)) ? (view.width - 1) : fm.stringWidth(text.substring(i, ie)); //java //midp font.substringWidth(text, i, ie - i); g.setColor(c_select); g.fillRect(1 + xs, ascent, xe - xs, fontheight); } g.setColor(enabled ? c_text : c_disable); g.drawString(line, 1, ascent + fontascent); //java //midp g.drawSubstring(text, i, ((j != -1) ? j : text.length()) - i, 1, ascent, Graphics.LEFT | Graphics.TOP); if (focus && (end >= i) && ((j == -1) || (end <= j))) { int caret = fm.stringWidth(text.substring(i, end)); //java //midp int caret = font.substringWidth(text, i, end - i); g.setColor(c_focus); g.fillRect(caret, ascent, 1, fontheight); } } ascent += fontheight; i = j + 1; } resetScrollPane(g, clipx, clipy, clipwidth, clipheight, view, viewport); } } else if ("tabbedpane" == classname) { int i = 0; Rectangle last = null; int selected = getInteger(component, "selected", 0); String placement = getString(component, "placement", "top"); for (Object comp = get(component, "tab"); comp != null; comp = get(comp, ":next")) { Rectangle r = getRectangle(comp, "bounds"); boolean hover = !(selected == i) && inside && (mousepressed == null) && (insidepart == comp); boolean sel = (selected == i); boolean tabenabled = enabled && getBoolean(comp, "enabled", true); paintRect(g, r.x, r.y, r.width, r.height, enabled ? c_border : c_disable, tabenabled ? (sel ? c_bg : (hover ? c_hover : c_ctrl)) : c_ctrl, (placement != "bottom") || !sel, (placement != "right") || !sel, (placement == "bottom") || ((placement == "top") && !sel), (placement == "right") || ((placement == "left") && !sel)); if (focus && sel) { g.setColor(c_focus); g.drawRect(r.x + 2, r.y + 2, r.width - 4, r.height - 4); } paintContent(comp, g, clipx, clipy, clipwidth, clipheight, r.x + 4, r.y + 2, r.width - 8, r.height - 4, tabenabled ? c_text : c_disable, "left", true); i++; last = r; } if (last != null) { boolean horizontal = ((placement == "top") || (placement == "bottom")); paintRect(g, horizontal ? (last.x + last.width) : last.x, horizontal ? last.y : (last.y + last.height), horizontal ? (bounds.width - last.x - last.width) : last.width, horizontal ? last.height : (bounds.height - last.y - last.height), enabled ? c_border : c_disable, c_bg, (placement != "top"), (placement != "left"), (placement == "top"), (placement == "left")); paintRect(g, (placement == "left") ? last.width : 0, (placement == "top") ? last.height : 0, horizontal ? bounds.width : (bounds.width - last.width), horizontal ? (bounds.height - last.height) : bounds.height, enabled ? c_border : c_disable, c_bg, (placement != "top"), (placement != "left"), (placement != "bottom"), (placement != "right")); } Object tabcontent = getItemImpl(component, "component", selected); if (tabcontent != null) { paint(g, clipx, clipy, clipwidth, clipheight, tabcontent, enabled); } } else if (("panel" == classname) || ("dialog" == classname)) { if ("dialog" == classname) { int titleheight = getInteger(component, "titleheight", 0); paintRect(g, 0, 0, bounds.width, 3 + titleheight, c_border, c_ctrl, true, true, false, true); paintRect(g, 0, 3 + titleheight, bounds.width, bounds.height - 3 - titleheight, c_border, c_press, false, true, true, true); paintContent(component, g, clipx, clipy, clipwidth, clipheight, 3, 2, bounds.width - 6, titleheight, c_text, "left", false); paintRect(g, 3, 3 + titleheight, bounds.width - 6, bounds.height - 6 - titleheight, c_border, c_bg, true, true, true, true); } else { paintRect(g, 0, 0, bounds.width, bounds.height, c_border, c_bg, false, false, false, false); } for (Object comp = get(component, "component"); comp != null; comp = get(comp, ":next")) { paint(g, clipx, clipy, clipwidth, clipheight, comp, enabled); } } else if ("desktop" == classname) { paintReverse(g, clipx, clipy, clipwidth, clipheight, get(component, "component"), enabled); //g.setColor(Color.red); if (clip != null) g.drawRect(clipx, clipy, clipwidth, clipheight); if (tooltipowner != null) { Rectangle r = getRectangle(tooltipowner, "tooltipbounds"); paintRect(g, r.x, r.y, r.width, r.height, c_border, c_bg, true, true, true, true); String text = getString(tooltipowner, "tooltip", null); g.setColor(c_text); g.drawString(text, r.x + 2, r.y + g.getFontMetrics().getAscent() + 2); //java //midp g.drawString(text, r.x + 2, r.y + (r.height - font.getHeight()) / 2, Graphics.LEFT | Graphics.TOP); } } else if ("spinbox" == classname) { paintField(g, clipx, clipy, clipwidth, clipheight, component, bounds.width - block, bounds.height, inside, pressed, focus, enabled, false, 0); paintArrow(g, bounds.width - block, 0, block, bounds.height / 2, 'N', enabled, inside, pressed, "up", true, false, false, true); paintArrow(g, bounds.width - block, bounds.height / 2, block, bounds.height - (bounds.height / 2), 'S', enabled, inside, pressed, "down", true, false, true, true); } else if ("progressbar" == classname) { int minimum = getInteger(component, "minimum", 0); int maximum = getInteger(component, "maximum", 100); int value = getInteger(component, "value", 0); boolean horizontal = ("vertical" != get(component, "orientation")); int length = (value - minimum) * ((horizontal ? bounds.width : bounds.height) - 1) / (maximum - minimum); paintRect(g, 0, 0, horizontal ? length : bounds.width, horizontal ? bounds.height : length, enabled ? c_border : c_disable, c_select, true, true, horizontal, !horizontal); paintRect(g, horizontal ? length : 0, horizontal ? 0 : length, horizontal ? (bounds.width - length) : bounds.width , horizontal ? bounds.height : (bounds.height - length), enabled ? c_border : c_disable, c_bg, true, true, true, true); } else if ("slider" == classname) { int minimum = getInteger(component, "minimum", 0); int maximum = getInteger(component, "maximum", 100); int value = getInteger(component, "value", 0); boolean horizontal = ("vertical" != get(component, "orientation")); int length = (value - minimum) * ((horizontal ? bounds.width : bounds.height) - block) / (maximum - minimum); paintRect(g, horizontal ? 0 : 3, horizontal ? 3 : 0, horizontal ? length : (bounds.width - 6), horizontal ? (bounds.height - 6) : length, enabled ? c_border : c_disable, c_bg, true, true, horizontal, !horizontal); paintRect(g, horizontal ? length : 0, horizontal ? 0 : length, horizontal ? block : bounds.width, horizontal ? bounds.height : block, enabled ? c_border : c_disable, enabled ? c_ctrl : c_bg, true, true, true, true); if (focus) { g.setColor(c_focus); g.drawRect(horizontal ? (length + 2) : 2, horizontal ? 2 : (length + 2), (horizontal ? block : bounds.width) - 5, (horizontal ? bounds.height : block) - 5); //g.drawRect(length + 1, 1, block - 3, bounds.height - 3); } paintRect(g, horizontal ? (block + length) : 3, horizontal ? 3 : (block + length), bounds.width - (horizontal ? (block + length) : 6), bounds.height - (horizontal ? 6 : (block + length)), enabled ? c_border : c_disable, c_bg, horizontal, !horizontal, true, true); } else if ("splitpane" == classname) { boolean horizontal = ("vertical" != get(component, "orientation")); int divider = getInteger(component, "divider", -1); paintRect(g, horizontal ? divider : 0, horizontal ? 0 : divider, horizontal ? 5 : bounds.width, horizontal ? bounds.height : 5, c_border, c_bg, false, false, false, false); g.setColor(enabled ? (focus ? c_focus : c_border) : c_disable); int xy = horizontal ? bounds.height : bounds.width; int xy1 = Math.max(0, xy / 2 - 12); int xy2 = Math.min(xy / 2 + 12, xy - 1); for (int i = divider + 1; i < divider + 4; i += 2) { if (horizontal) { g.drawLine(i, xy1, i, xy2); } else { g.drawLine(xy1, i, xy2, i); } } Object comp1 = get(component, "component"); if (comp1 != null) { paint(g, clipx, clipy, clipwidth, clipheight, comp1, enabled); Object comp2 = get(comp1, ":next"); if (comp2 != null) { paint(g, clipx, clipy, clipwidth, clipheight, comp2, enabled); } } } else if (("list" == classname) || ("table" == classname) || ("tree" == classname)) { Rectangle view = getRectangle(component, ":view"); Rectangle viewport = getRectangle(component, ":port"); int[] columnwidths = null; int lx = clipx - viewport.x - 1; int xfrom = view.x + Math.max(0, lx); int xto = view.x + Math.min(viewport.width - 2, lx + clipwidth); if ("table" == classname) { columnwidths = new int[getItemCountImpl(component, "column")]; int i = 0; int x = 0; boolean drawheader = (clipy < viewport.y); if (drawheader) { g.setClip(viewport.x, 0, viewport.width, viewport.y); } for (Object column = get(component, "column"); column != null; column = get(column, ":next")) { boolean lastcolumn = (i == columnwidths.length - 1); int width = getInteger(column, "width", 80); if (lastcolumn) { width = Math.max(width, viewport.width - x); } columnwidths[i] = width; if (drawheader && (xfrom < x + width) && (xto > x)) { paintRect(g, x - view.x, 0, width, viewport.y, enabled ? c_border : c_disable, enabled ? c_ctrl : c_bg, true, true, false, lastcolumn); paintContent(column, g, clipx, clipy, clipwidth, clipheight, x + 2 - view.x, 1, width - 2, viewport.y - 2, enabled ? c_text : c_disable, "left", false); } i++; x += width; } if (drawheader) { g.setClip(clipx, clipy, clipwidth, clipheight); } } paintRect(g, viewport.x, viewport.y, viewport.width, viewport.height, enabled ? c_border : c_disable, c_textbg, true, true, true, true); if (paintScrollPane(g, clipx, clipy, clipwidth, clipheight, bounds, view, viewport, enabled, inside, pressed)) { Object lead = get(component, "lead"); int ly = clipy - viewport.y - 1; int yfrom = view.y + Math.max(0, ly); int yto = view.y + Math.min(viewport.height - 2, ly + clipheight); for (Object item = get(component, ("list" == classname) ? "item" : (("table" == classname) ? "row" : "node")); item != null;) { Rectangle r = getRectangle(item, "bounds"); if (lead == null) { set(component, "lead", lead = item); // draw first item focused when lead is null } if (yto <= r.y) { break; } // the clip bounds are above Object next = ("tree" == classname) ? get(item, "node") : null; boolean expanded = (next != null) && getBoolean(item, "expanded", true); if (yfrom < r.y + r.height) { // the clip rectangle is not bellow the current item boolean selected = getBoolean(item, "selected", false); paintRect(g, 0, r.y, view.width, r.height, c_bg, selected ? c_select : c_textbg, false, false, true, false); if (focus && (lead == item)) { g.setColor(c_focus); g.drawRect(0, r.y, view.width - 1, r.height - 2); } if ("table" == classname) { int x = 0; int i = 0; for (Object cell = get(item, "cell"); cell != null; cell = get(cell, ":next")) { if (xto <= x) { break; } int iwidth = (i < columnwidths.length) ? columnwidths[i] : 80; if (xfrom < x + iwidth) { boolean cellenabled = enabled && getBoolean(cell, "enabled", true); paintContent(cell, g, xfrom, yfrom, xto - xfrom, yto - yfrom, r.x + x + 1, r.y + 1, iwidth - 2, r.height - 3, cellenabled ? c_text : c_disable, "left", false); } x += iwidth; i++; } } else { boolean itemenabled = enabled && getBoolean(item, "enabled", true); paintContent(item, g, xfrom, yfrom, xto - xfrom, yto - yfrom, r.x + 1, r.y + 1, view.width - r.x - 2, r.height - 3, itemenabled ? c_text : c_disable, "left", false); if (next != null) { int x = r.x - block / 2; int y = r.y + (r.height - 1) / 2; //g.drawRect(x - 4, y - 4, 8, 8); paintRect(g, x - 4, y - 4, 9, 9, itemenabled ? c_border : c_disable, itemenabled ? c_ctrl : c_bg, true, true, true, true); g.setColor(itemenabled ? c_text : c_disable); g.drawLine(x - 2, y, x + 2, y); if (!expanded) { g.drawLine(x, y - 2, x, y + 2); } } } } if ("tree" == classname) { if ((next == null) || !expanded) { while ((item != component) && ((next = get(item, ":next")) == null)) { item = getParent(item); } } item = next; } else { item = get(item, ":next"); } } /*if (columnwidths != null) { g.setColor(c_bg); for (int i = 0, cx = -1; i < columnwidths.length - 1; i++) { cx += columnwidths[i]; g.drawLine(cx, 0, cx, view.height); } }*/ resetScrollPane(g, clipx, clipy, clipwidth, clipheight, view, viewport); } } else if ("separator" == classname) { g.setColor(enabled ? c_border : c_disable); g.fillRect(0, 0, bounds.width, bounds.height); } else if ("menubar" == classname) { Object selected = get(component, "selected"); int lastx = 0; for (Object menu = get(component, "menu"); menu != null; menu = get(menu, ":next")) { Rectangle mb = getRectangle(menu, "bounds"); if (clipx + clipwidth <= mb.x) { break; } if (clipx >= mb.x + mb.width) { continue; } boolean armed = (selected == menu); boolean hoover = (selected == null) && (insidepart == menu); paintRect(g, mb.x, 0, mb.width, bounds.height, enabled ? c_border : c_disable, enabled ? (armed ? c_select : (hoover ? c_hover : c_ctrl)) : c_bg, armed, armed, true, armed); paintContent(menu, g, clipx, clipy, clipwidth, clipheight, mb.x + 4, 1, mb.width, bounds.height, (enabled && getBoolean(menu, "enabled", true)) ? c_text : c_disable, "left", true); lastx = mb.x + mb.width; } paintRect(g, lastx, 0, bounds.width - lastx, bounds.height, enabled ? c_border : c_disable, enabled ? c_ctrl : c_bg, false, false, true, false); } else if ("popupmenu" == classname) { paintRect(g, 0, 0, bounds.width, bounds.height, c_border, c_bg, true, true, true, true); Object selected = get(component, "selected"); for (Object menu = get(get(component, "menu"), "menu"); menu != null; menu = get(menu, ":next")) { Rectangle r = getRectangle(menu, "bounds"); if (clipy + clipheight <= r.y) { break; } if (clipy >= r.y + r.height) { continue; } String itemclass = getClass(menu); if (itemclass == "separator") { g.setColor(c_border); g.fillRect(r.x, r.y, bounds.width - 2, r.height); } else { boolean armed = (selected == menu); boolean menuenabled = getBoolean(menu, "enabled", true); paintRect(g, r.x, r.y, bounds.width - 2, r.height, c_border, armed ? c_select : c_bg, false, false, false, false); int tx = r.x; if (itemclass == "checkboxmenuitem") { tx += block + 3; boolean checked = getBoolean(menu, "selected", false); String group = getString(menu, "group", null); g.translate(r.x + 4, r.y + 2); g.setColor(menuenabled ? c_border : c_disable); if (group == null) { g.drawRect(1, 1, block - 3, block - 3); } else { g.drawOval(1, 1, block - 3, block - 3); //java } if (checked) { g.setColor(menuenabled ? c_text : c_disable); if (group == null) { g.fillRect(3, block - 9, 2, 6); g.drawLine(3, block - 4, block - 4, 3); g.drawLine(4, block - 4, block - 4, 4); } else { g.fillOval(5, 5, block - 10, block - 10); //java g.drawOval(4, 4, block - 9, block - 9); //java } } g.translate(-r.x - 4, -r.y - 2); } paintContent(menu, g, clipx, clipy, clipwidth, clipheight, tx + 4, r.y + 2, bounds.width - 10, r.height - 4, menuenabled ? c_text : c_disable, "left", true); if (itemclass == "menu") { paintArrow(g, r.x + bounds.width - block, r.y, block, r.height, 'E'); } } } } //java> else if ("bean" == classname) { g.clipRect(0, 0, bounds.width, bounds.height); ((Component) get(component, "bean")).paint(g); g.setClip(clipx, clipy, clipwidth, clipheight); } //<java else throw new IllegalArgumentException((String) classname); g.translate(-bounds.x, -bounds.y); clipx += bounds.x; clipy += bounds.y; }