private class TransparentPanel extends JPanel { { setOpaque(false); } public void paintComponent(Graphics g) { g.setColor(getBackground()); Rectangle r = g.getClipBounds(); g.fillRect(r.x, r.y, r.width, r.height); super.paintComponent(g); } }
Insets insets = getInsets(); int availableWidth = size.width - insets.left - insets.right; Rectangle clip = g.getClipBounds(); int rowStartOffset = codeArea.viewToModel(new Point(0, clip.y)); int endOffset = codeArea.viewToModel(new Point(0, clip.y + clip.height));
@Override public void paint(Graphics g, JComponent c) { Rectangle clipBounds = g.getClipBounds(); if (header.getColumnModel() == null) { return;
Rectangle clip = g.getClipBounds(); int rowStartOffset = component.viewToModel(new Point(0, clip.y)); int endOffset = component.viewToModel(new Point(0, clip.y + clip.height));
@Override protected void paintComponent(Graphics g) { Rectangle drawHere = g.getClipBounds();
Rectangle rect = graphics.getClipBounds(); graphics.setClip(rect.x, 0, rect.width, (int) paper.getHeight() + 100);
configureFormatter(); double lineDistance = getLineDistance(); Rectangle clip = g.getClipBounds(); g.clearRect(clip.x, clip.y, clip.width, clip.height); g.setColor(Color.black);
@Override protected void paintComponent(Graphics g) { super.paintComponent(g); Rectangle bounds = g.getClipBounds(); int index = 0; for (String name : shortLineNames.keySet()) { int nameWidth = g.getFontMetrics().stringWidth(name); int lineX = lineStep * index; index++; if (bounds.getMaxX() < lineX || bounds.getMinX() > lineX + nameWidth) { continue; } g.setClip(lineX + LINE_LABEL_BOUNDARY, 0, lineStep - +LINE_LABEL_BOUNDARY * 2, getHeight()); g.drawString(name, lineX + LINE_LABEL_BOUNDARY, AXIS_SIZE / 3); g.setClip(null); } } }
Rectangle clipBounds = componentGraphics.getClipBounds(); if(clipBounds == null) { clipBounds = new Rectangle(0, 0, getWidth(), getHeight());
@Override public void paint(Graphics g) { g.setColor(color); Rectangle r = g.getClipBounds(); g.fillRect(r.x, r.y, r.width, r.height); }
private void drawRed(Graphics g) { Rectangle r = g.getClipBounds(); int width = r.width - WIDTH_OFFSET; for (int i = 0; i < width; i++) { Color c = new Color((float) i / width, green, blue); g.setColor(c); g.fillRect(i + HALF_WIDTH_OFFSET, 0, 1, r.height - HEIGHT_OFFSET); } }
private void drawAlpha(Graphics g) { Rectangle r = g.getClipBounds(); int width = r.width - WIDTH_OFFSET; for (int i = 0; i < width; i++) { Color c = new Color(red, green, blue, (float) i / width); g.setColor(c); g.fillRect(i + HALF_WIDTH_OFFSET, 0, 1, r.height - HEIGHT_OFFSET); } }
private void drawBlue(Graphics g) { Rectangle r = g.getClipBounds(); int width = r.width - WIDTH_OFFSET; for (int i = 0; i < width; i++) { Color c = new Color(red, green, (float) i / width); g.setColor(c); g.fillRect(i + HALF_WIDTH_OFFSET, 0, 1, r.height - HEIGHT_OFFSET); } }
private void drawGreen(Graphics g) { Rectangle r = g.getClipBounds(); int width = r.width - WIDTH_OFFSET; for (int i = 0; i < width; i++) { Color c = new Color(red, (float) i / width, blue); g.setColor(c); g.fillRect(i + HALF_WIDTH_OFFSET, 0, 1, r.height - HEIGHT_OFFSET); } }
private void drawHue(Graphics g) { Rectangle r = g.getClipBounds(); int width = r.width - WIDTH_OFFSET; for (int i = 0; i < width; i++) { Color hsb = Color.getHSBColor((float) i / width, saturation, brightness); Color c = new Color(hsb.getRed(), hsb.getGreen(), hsb.getBlue()); g.setColor(c); g.fillRect(i + HALF_WIDTH_OFFSET, 0, 1, r.height - HEIGHT_OFFSET); } }
private void drawBrightness(Graphics g) { Rectangle r = g.getClipBounds(); int width = r.width - WIDTH_OFFSET; for (int i = 0; i < width; i++) { Color hsb = Color.getHSBColor(hue, saturation, (float) i / width); Color c = new Color(hsb.getRed(), hsb.getGreen(), hsb.getBlue()); g.setColor(c); g.fillRect(i + HALF_WIDTH_OFFSET, 0, 1, r.height - HEIGHT_OFFSET); } }
@Override public void paint(Graphics g) { g.setColor(color.getAwtColor()); Rectangle r = g.getClipBounds(); g.fillRect(r.x, r.y, r.width, r.height); }
private void drawSaturation(Graphics g) { Rectangle r = g.getClipBounds(); int width = r.width - WIDTH_OFFSET; for (int i = 0; i < width; i++) { Color hsb = Color.getHSBColor(hue, (float) i / width, brightness); Color c = new Color(hsb.getRed(), hsb.getGreen(), hsb.getBlue()); g.setColor(c); g.fillRect(i + HALF_WIDTH_OFFSET, 0, 1, r.height - HEIGHT_OFFSET); } }
@Override protected void paintBackground(Graphics g) { // Only fill in the background if an image isn't being used. Color bg = textArea.getBackground(); if (bg!=null) { g.setColor(bg); //g.fillRect(0, 0, textArea.getWidth(), textArea.getHeight()); Rectangle r = g.getClipBounds(); g.fillRect(r.x,r.y, r.width,r.height); } paintEditorAugmentations(g); }
@Override protected void paintComponent(Graphics g) { super.paintComponent(g); // #9804. Draw bullet if the content is not numbered. if (!WrappedCellRenderer.this.contentNumbered) { java.awt.Rectangle rect = g.getClipBounds(); g.fillOval(rect.x, rect.y, 7, 7); } } };