/** * Sets the clip on a graphics object by merging a supplied clip with the existing one. The new * clip will be an intersection of the old clip and the supplied clip. The old clip shape will * be returned. This is useful for resetting the old clip after an operation is performed. * * @param g * the graphics object to update * @param clip * a new clipping region to add to the graphics clip. * @return the current clipping region of the supplied graphics object. This may return {@code * null} if the current clip is {@code null}. * @throws NullPointerException * if any parameter is {@code null} * @deprecated Use {@link ShapeUtils#mergeClip(Graphics,Shape)} instead */ @Deprecated public static Shape mergeClip(Graphics g, Shape clip) { return ShapeUtils.mergeClip(g, clip); }
@Override protected void doPaint(Graphics2D g, Object component, int width, int height) { Shape shape = provideShape(g, component, width, height); switch (getStyle()) { case BOTH: drawBackground(g,shape,width,height); drawBorder(g,shape,width,height); break; case FILLED: drawBackground(g,shape,width,height); break; case OUTLINE: drawBorder(g,shape,width,height); break; } // background // border // leave the clip to support masking other painters ShapeUtils.mergeClip(g,shape); /* Area area = new Area(g.getClip()); area.intersect(new Area(shape));//new Rectangle(0,0,width,height))); g.setClip(area);*/ //g.setClip(shape); }
@Override protected void doPaint(Graphics2D g, Object component, int width, int height) { Shape shape = provideShape(g, component, width, height); switch (getStyle()) { case BOTH: drawBackground(g,shape,width,height); drawBorder(g,shape,width,height); break; case FILLED: drawBackground(g,shape,width,height); break; case OUTLINE: drawBorder(g,shape,width,height); break; } // background // border // leave the clip to support masking other painters ShapeUtils.mergeClip(g,shape); /* Area area = new Area(g.getClip()); area.intersect(new Area(shape));//new Rectangle(0,0,width,height))); g.setClip(area);*/ //g.setClip(shape); }
@Override protected void doPaint(Graphics2D g, Object component, int width, int height) { Shape shape = provideShape(g, component, width, height); switch (getStyle()) { case BOTH: drawBackground(g,shape,width,height); drawBorder(g,shape,width,height); break; case FILLED: drawBackground(g,shape,width,height); break; case OUTLINE: drawBorder(g,shape,width,height); break; } // background // border // leave the clip to support masking other painters ShapeUtils.mergeClip(g,shape); /* Area area = new Area(g.getClip()); area.intersect(new Area(shape));//new Rectangle(0,0,width,height))); g.setClip(area);*/ //g.setClip(shape); }