void (Object component, Graphics g, int clipx, int clipy, int clipwidth, int clipheight, int x, int y, int width, int height, Color fg, String defaultalignment, boolean checkmnemonic) { String text = getString(component, "text", null); Image icon = getIcon(component, "icon", null); if ((text == null) && (icon == null)) { return; } String alignment = getString(component, "alignment", defaultalignment); FontMetrics fm = null; //java int tw = 0, th = 0; int ta = 0; //java if (text != null) { fm = g.getFontMetrics(); //java tw = fm.stringWidth(text); ta = fm.getAscent(); //java th = fm.getDescent() + ta; //java //midp th = font.getHeight(); g.setColor(fg); } int iw = 0, ih = 0; if (icon != null) { iw = icon.getWidth(this); ih = icon.getHeight(this); //java } boolean clipped = (tw + iw > width) || (th > height) || (ih > height); int cx = x; if ("center" == alignment) { cx += (width - tw - iw) / 2; } else if ("right" == alignment) { cx += width - tw - iw; } if (clipped) { g.clipRect(x, y, width, height); } if (icon != null) { g.drawImage(icon, cx, y + (height - ih) / 2, this); //java //midp g.drawImage(icon, cx, y + height / 2, Graphics.LEFT | Graphics.VCENTER); cx += iw; } if (text != null) { int ty = y + (height - th) / 2 + ta; //java g.drawString(text, cx, ty); //java //midp g.drawString(text, cx, y + (height - th) / 2, Graphics.LEFT | Graphics.TOP); if (checkmnemonic) { int mnemonic = getInteger(component, "mnemonic", -1); if ((mnemonic != -1) && (mnemonic < text.length())) { int mx = cx + fm.stringWidth(text.substring(0, mnemonic)); //java //midp int mx = cx + font.substringWidth(text, 0, mnemonic); //midp int ty = (height + th) / 2; g.drawLine(mx, ty + 1, mx + fm.charWidth(text.charAt(mnemonic)), ty + 1); } } } if (clipped) { g.setClip(clipx, clipy, clipwidth, clipheight); } }