/** * Draws a visualization tooltip. * * @param g graphics reference * @param tt tooltip label * @param x horizontal position * @param y vertical position * @param w width * @param c color color depth */ public static void drawTooltip( final Graphics g, final String tt, final int x, final int y, final int w, final int c) { final int tw = width(g, tt); final int th = g.getFontMetrics().getHeight(); final int xx = Math.min(w - tw - 8, x); g.setColor(color(c)); g.fillRect(xx - 1, y - th, tw + 4, th); g.setColor(BACK); g.drawString(tt, xx, y - 4); }
public void paint(Graphics g) { super.paint(g); if (!isEditing) return; Dimension psize = getPreferredSize(); if (isFocused) g.setColor(Color.yellow); else g.setColor(Color.green); g.drawLine(0, 0, psize.width, 0); g.drawLine(0, 0, 0, psize.height); g.drawLine(0, psize.height - 1, psize.width - 1, psize.height - 1); g.drawLine(psize.width - 1, 0, psize.width - 1, psize.height - 1); }
/** * Draws a colored cell. * * @param g graphics reference * @param xs horizontal start position * @param xe horizontal end position * @param ys vertical start position * @param ye vertical end position * @param focus highlighting flag */ public static void drawCell( final Graphics g, final int xs, final int xe, final int ys, final int ye, final boolean focus) { g.setColor(gray); g.drawRect(xs, ys, xe - xs - 1, ye - ys - 1); g.setColor(BACK); g.drawRect(xs + 1, ys + 1, xe - xs - 3, ye - ys - 3); g.setColor(focus ? lgray : BACK); g.fillRect(xs + 1, ys + 1, xe - xs - 2, ye - ys - 2); }
public void paint(Graphics g) { g.setColor(Color.YELLOW); int i = 0; for (Iterator<File> iterator = content.iterator(); iterator.hasNext(); i++) { g.drawString(iterator.next().getName(), 5, g.getFontMetrics().getAscent() * i + 20); } }
@Override protected void paintChildren(Graphics g) { autoscale(); super.paintChildren(g); if (IGV.getInstance().isRulerEnabled()) { int start = MouseInfo.getPointerInfo().getLocation().x - getLocationOnScreen().x; g.setColor(Color.BLACK); g.drawLine(start, 0, start, getHeight()); } }