@Override protected void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D) g; g.setFont(Theme.SMALL_BOLD_FONT); if (isSelected()) { g.setColor(Theme.SELECTED_TAB_BACKGROUND_COLOR); g2.fill(g.getClip()); g.setColor(Theme.TEXT_NORMAL_COLOR); } else { g.setColor(Theme.TAB_BACKGROUND_COLOR); g2.fill(g.getClip()); g.setColor(Theme.TEXT_DISABLED_COLOR); } SwingUtils.drawShadowText((Graphics2D) g, getText(), 5, 14); } }
g.drawChars(chars, 0, length, x, y); } else { Shape shape = g.getClip();
if (clippedCanvas instanceof mxGraphics2DCanvas) { System.out.println("setting new clip"); Graphics g = ((mxGraphics2DCanvas) clippedCanvas).getGraphics(); clip = g.getClip(); g.setClip(newClip); ((mxGraphics2DCanvas) clippedCanvas).paintRectangle(((mxGraphics2DCanvas) clippedCanvas).getGraphics().getClipBounds(), Color.GREEN, Color.WHITE); }
private void drawChessboardBackground(Graphics g, int x, int y, int w, int h) { int s = 8; int ni = w / s + 1; int nj = h / s + 1; Shape clip = g.getClip(); g.setClip(x, y, w, h); for (int j = 0; j < nj; j++) { for (int i = 0; i < ni; i++) { g.setColor(i % 2 != j % 2 ? Color.WHITE : Color.LIGHT_GRAY); g.fillRect(x + i * s, y + j * s, s, s); } } g.setClip(clip); }
public void paintIcon(Component c, java.awt.Graphics g, int x, int y) { g.setColor(Color.BLACK); g.drawRect(x, y, ICON_SIZE + 2, ICON_SIZE + 2); g.translate(x + 1, y + 1); Shape old = g.getClip(); g.setClip(bounds.intersection(old.getBounds())); overlay.paintOverlay((Graphics2D) g, token, bounds, value); g.setClip(old); g.translate(-(x + 1), -(y + 1)); } };
private void drawImageInShape(Graphics g, Image image, org.microemu.device.impl.Shape shape) { Shape clipSave = g.getClip(); if (shape instanceof org.microemu.device.impl.Polygon) { Polygon poly = new Polygon(((org.microemu.device.impl.Polygon) shape).xpoints, ((org.microemu.device.impl.Polygon) shape).ypoints, ((org.microemu.device.impl.Polygon) shape).npoints); g.setClip(poly); } org.microemu.device.impl.Rectangle r = shape.getBounds(); g.drawImage(image, r.x, r.y, r.x + r.width, r.y + r.height, r.x, r.y, r.x + r.width, r.y + r.height, null); g.setClip(clipSave); }
protected void paintComponent(final Graphics _g) { if (l_.getEpaisseur() <= 0) { return; } final Color old = _g.getColor(); _g.setColor(getBackground()); ((Graphics2D) _g).fill(_g.getClip()); final Dimension d = getSize(); l_.dessineTrait((Graphics2D) _g, 0, d.height / 2, d.width, d.height / 2); _g.setColor(old); }
if (clippedCanvas instanceof mxGraphics2DCanvas) { Graphics g = ((mxGraphics2DCanvas) clippedCanvas).getGraphics(); clip = g.getClip(); if (clip instanceof Rectangle) { g.setClip(newClip.intersection((Rectangle) clip)); } else { g.setClip(newClip); } }
@Override protected void paintComponent(Component comp, Graphics g) { Graphics g2 = getGraphicsImpl(); g2.setClip(g.getClip()); peerPaint(g2, false); g2.dispose(); super.paintComponent(comp, g); } };
@Override protected void updateComponent(Component comp, Graphics g) { Graphics g2 = getGraphicsImpl(); g2.setClip(g.getClip()); peerPaint(g2, true); g2.dispose(); super.updateComponent(comp, g); } @Override
public void paintIcon(Component c, java.awt.Graphics g, int x, int y) { Shape old = g.getClip(); g.setClip(bounds.intersection(old.getBounds())); BufferedImage image = ImageManager.getImageAndWait(key); g.drawImage(image, x, y, bounds.width, bounds.height, null); g.setClip(old); } };
@Override public void paintLayeredHighlights( Graphics g, int p0, int p1, Shape viewBounds, JTextComponent editor, View view ) { Shape saveClip = g.getClip(); Rectangle rc = viewBounds.getBounds(); g.clipRect( 0, rc.y, getWidth(), rc.height ); paintBreakpoints( g, rc ); g.setClip( saveClip ); // Paint these last so that selection highlights paint over breakpoint highlights _highlighter.paintLayeredHighlights( g, p0, p1, viewBounds, editor, view ); }
public void paint(Graphics g, JComponent c) { Shape clip = g.getClip(); paintImpl(g, c); g.setClip(clip); paintDropLine(g); }
public void paintIcon(Component _c, Graphics _g, int _x, int _y) { Shape old=_g.getClip(); _g.clipRect(_x,_y,getIconWidth(),getIconHeight()); int x=_x+dx_; int y=_y+dy_; icon_.paintIcon(_c,_g,x,y); _g.setClip(old); } }
/** * Paint the rows that intersect the Graphics objects clipRect. This * method calls paintCell as necessary. Subclasses * may want to override these methods. * * @see #paintCell */ public void paint(Graphics g, JComponent c) { Shape clip = g.getClip(); paintImpl(g, c); g.setClip(clip); paintDropLine(g); }
/** * Paint the rows that intersect the Graphics objects clipRect. This * method calls paintCell as necessary. Subclasses * may want to override these methods. * * @see #paintCell */ public void paint(Graphics g, JComponent c) { Shape clip = g.getClip(); paintImpl(g, c); g.setClip(clip); paintDropLine(g); }
/** * Paint the rows that intersect the Graphics objects clipRect. This * method calls paintCell as necessary. Subclasses * may want to override these methods. * * @see #paintCell */ public void paint(Graphics g, JComponent c) { Shape clip = g.getClip(); paintImpl(g, c); g.setClip(clip); paintDropLine(g); }
/** * Paint the rows that intersect the Graphics objects clipRect. This * method calls paintCell as necessary. Subclasses * may want to override these methods. * * @see #paintCell */ public void paint(Graphics g, JComponent c) { Shape clip = g.getClip(); paintImpl(g, c); g.setClip(clip); paintDropLine(g); }
public void paintBorder(Component _c, Graphics _g, int _x, int _y, int _w, int _h) { Shape old=_g.getClip(); Insets r =border_.getBorderInsets(_c); _g.clipRect(_x,_y,_w,_h); int dx=left_ ? 0 : -r.left; int dy=top_ ? 0 : -r.top; int dw=right_ ? -dx : -dx+r.right; int dh=bottom_ ? -dy : -dy+r.bottom; border_.paintBorder(_c,_g,_x+dx,_y+dy,_w+dw,_h+dh); _g.setClip(old); }
private void paintDragDivider(Graphics g, int x, int y, int w, int h) { SeaGlassContext context = getContext(splitPane, Region.SPLIT_PANE_DIVIDER); context.setComponentState(((context.getComponentState() | MOUSE_OVER) ^ MOUSE_OVER) | PRESSED); Shape oldClip = g.getClip(); g.clipRect(x, y, w, h); context.getPainter().paintSplitPaneDragDivider(context, g, x, y, w, h, splitPane.getOrientation()); g.setClip(oldClip); context.dispose(); }