congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Graphics.getClipBounds
Code IndexAdd Tabnine to your IDE (free)

How to use
getClipBounds
method
in
java.awt.Graphics

Best Java code snippets using java.awt.Graphics.getClipBounds (Showing top 20 results out of 1,287)

origin: stackoverflow.com

 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);
  }
}
origin: skylot/jadx

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));
origin: alibaba/druid

@Override
public void paint(Graphics g, JComponent c) {
  Rectangle clipBounds = g.getClipBounds();
  if (header.getColumnModel() == null) {
    return;
origin: SonarSource/sonarqube

Rectangle clip = g.getClipBounds();
int rowStartOffset = component.viewToModel(new Point(0, clip.y));
int endOffset = component.viewToModel(new Point(0, clip.y + clip.height));
origin: apache/geode

@Override
protected void paintComponent(Graphics g) {
 Rectangle drawHere = g.getClipBounds();
origin: groovy/groovy-core

Rectangle rect = graphics.getClipBounds();
graphics.setClip(rect.x, 0, rect.width, (int) paper.getHeight() + 100);
origin: chewiebug/GCViewer

configureFormatter();
double lineDistance = getLineDistance();
Rectangle clip = g.getClipBounds();
g.clearRect(clip.x, clip.y, clip.width, clip.height);
g.setColor(Color.black);
origin: apache/geode

 @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);
  }
 }
}
origin: mabe02/lanterna

Rectangle clipBounds = componentGraphics.getClipBounds();
if(clipBounds == null) {
  clipBounds = new Rectangle(0, 0, getWidth(), getHeight());
origin: nodebox/nodebox

@Override
public void paint(Graphics g) {
  g.setColor(color);
  Rectangle r = g.getClipBounds();
  g.fillRect(r.x, r.y, r.width, r.height);
}
origin: nodebox/nodebox

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);
  }
}
origin: nodebox/nodebox

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);
  }
}
origin: nodebox/nodebox

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);
  }
}
origin: nodebox/nodebox

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);
  }
}
origin: nodebox/nodebox

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);
  }
}
origin: nodebox/nodebox

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);
  }
}
origin: nodebox/nodebox

@Override
public void paint(Graphics g) {
  g.setColor(color.getAwtColor());
  Rectangle r = g.getClipBounds();
  g.fillRect(r.x, r.y, r.width, r.height);
}
origin: nodebox/nodebox

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);
  }
}
origin: bobbylight/RSyntaxTextArea

@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);
}
origin: org.netbeans.api/org-openide-dialogs

  @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);
    }
  }
};
java.awtGraphicsgetClipBounds

Javadoc

Returns the bounding rectangle of the current clipping area. The coordinates in the rectangle are relative to the coordinate system origin of this graphics context. This method differs from #getClipBounds() in that an existing rectangle is used instead of allocating a new one. This method refers to the user clip, which is independent of the clipping associated with device bounds and window visibility. If no clip has previously been set, or if the clip has been cleared using setClip(null), this method returns the specified Rectangle.

Popular methods of Graphics

  • setColor
  • drawImage
    Draws as much of the specified image as is currently available. The image is drawn with its top-left
  • fillRect
    Fills the specified rectangle. The left and right edges of the rectangle are atx and x + width - 1.
  • drawLine
    Draws a line, using the current color, between the points(x1, y1) and (x2, y2) in this graphics con
  • drawString
    Draws the text given by the specified iterator, using this graphics context's current color. The ite
  • dispose
    Disposes of this graphics context and releases any system resources that it is using. A Graphics obj
  • setFont
    Sets this graphics context's font to the specified font. All subsequent text operations using this g
  • drawRect
    Draws the outline of the specified rectangle. The left and right edges of the rectangle are atx and
  • getFontMetrics
  • create
    Creates a new Graphics object based on thisGraphics object, but with a new translation and clip area
  • getColor
    Gets this graphics context's current color.
  • translate
    Translates the origin of the graphics context to the point (x,y) in the current coordinate system. M
  • getColor,
  • translate,
  • setClip,
  • getFont,
  • fillPolygon,
  • fillOval,
  • drawOval,
  • getClip,
  • drawRoundRect

Popular in Java

  • Making http post requests using okhttp
  • setScale (BigDecimal)
  • findViewById (Activity)
  • requestLocationUpdates (LocationManager)
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • Reference (javax.naming)
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now