Tabnine Logo
Graphics.fillRoundRect
Code IndexAdd Tabnine to your IDE (free)

How to use
fillRoundRect
method
in
java.awt.Graphics

Best Java code snippets using java.awt.Graphics.fillRoundRect (Showing top 20 results out of 396)

origin: stackoverflow.com

Graphics g = bi.createGraphics();
g.setColor(new Color(255, 255, 255, 128));
g.fillRoundRect(
  0,
  0,
origin: marytts/marytts

private void createShadowPicture(BufferedImage image) {
  int width = image.getWidth();
  int height = image.getHeight();
  int extra = 0;
  if (System.getProperty("os.name").equalsIgnoreCase("Windows XP")) {
    extra = 14; // Only create shadow if Windows XP (avoids double shadow in Mac OS; not tested for other OSes)
  }
  setSize(new Dimension(width + extra, height + extra));
  setLocationRelativeTo(null);
  Rectangle windowRect = getBounds();
  splash = new BufferedImage(width + extra, height + extra, BufferedImage.TYPE_INT_ARGB);
  Graphics2D g2 = (Graphics2D) splash.getGraphics();
  try {
    Robot robot = new Robot(getGraphicsConfiguration().getDevice());
    BufferedImage capture = robot.createScreenCapture(new Rectangle(windowRect.x, windowRect.y, windowRect.width + extra,
        windowRect.height + extra));
    g2.drawImage(capture, null, 0, 0);
  } catch (AWTException e) {
  }
  BufferedImage shadow = new BufferedImage(width + extra, height + extra, BufferedImage.TYPE_INT_ARGB);
  Graphics g = shadow.getGraphics();
  g.setColor(new Color(0.0f, 0.0f, 0.0f, 0.3f));
  g.fillRoundRect(6, 6, width, height, 12, 12);
  g2.drawImage(shadow, getBlurOp(7), 0, 0);
  g2.drawImage(image, 0, 0, this);
}
origin: stackoverflow.com

g2d.fillRoundRect(3, 3, getWidth()-4, getHeight()-4, archH, archH);
setForeground(Color.black);
origin: stackoverflow.com

protected void paintComponent( Graphics g ) {
  g.setColor( getBackground() );
  g.fillRoundRect( 1, 1, getWidth()-2 - 1, getHeight()-2 ,2 ,2 );
  Graphics2D g2 = (Graphics2D)g;
origin: magefree/mage

  public void paintInternalFrameBackground(SynthContext context,
      Graphics g, int x, int y, int w, int h) {
    g.setColor(new Color(50, 50, 50, 100));
    g.fillRoundRect(x, y, w, h, 5, 5);
  }
};
origin: haraldk/TwelveMonkeys

public void paintIcon(Component c, Graphics g, int x, int y) {
  ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
  g.setColor(Color.DARK_GRAY);
  g.fillRoundRect(x, y, SIZE, SIZE, 10, 10);
  g.drawImage(image, (SIZE - image.getWidth()) / 2 +  x,  (SIZE - image.getHeight()) / 2 + y, null);
}
origin: bobbylight/RSyntaxTextArea

protected void paintMatchedBracketImpl(Graphics g, RSyntaxTextArea rsta,
    Rectangle r) {
  // We must add "-1" to the height because otherwise we'll paint below
  // the region that gets invalidated.
  if (rsta.getAnimateBracketMatching()) {
    Color bg = rsta.getMatchedBracketBGColor();
    final int arcWH = 5;
    if (bg!=null) {
      g.setColor(bg);
      g.fillRoundRect(r.x,r.y, r.width,r.height-1, arcWH, arcWH);
    }
    g.setColor(rsta.getMatchedBracketBorderColor());
    g.drawRoundRect(r.x,r.y, r.width,r.height-1, arcWH, arcWH);
  }
  else {
    Color bg = rsta.getMatchedBracketBGColor();
    if (bg!=null) {
      g.setColor(bg);
      g.fillRect(r.x,r.y, r.width,r.height-1);
    }
    g.setColor(rsta.getMatchedBracketBorderColor());
    g.drawRect(r.x,r.y, r.width,r.height-1);
  }
}
origin: stackoverflow.com

g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setColor(Color.DARK_GRAY);
g2d.fillRoundRect(getWidth()/2-100, getHeight()/2-15, 200, 30, 30, 30);
g2d.setColor(Color.WHITE);
g2d.drawString("Loading image...", getWidth()/2 - 45, getHeight()/2 + 3 );
origin: org.fudaa.framework.ctulu/ctulu-bu

public void fillRoundRect
 (Graphics _g, int _x, int _y, int _w, int _h,
  int _rh, int _rv)
{
 _g.fillRoundRect(_x,_y,_w,_h,_rh,_rv);
}
origin: stackoverflow.com

 paintComponent(Graphics g) {
  //If you want more: Graphics2D g2 = (Graphics2D) g;
  Rect rect = getBounds();
  g.setColor(Color.BLACK);
  g.fillRect(rect.x, rect,y, rect.width, rect.height);
  rect.grow(-4, -4);
  g.setColor(getBackground());
  g.fillRoundRect(rect.x, rect,y, rect.width, rect.height, 5, 5);
}
origin: com.twelvemonkeys.imageio/imageio-thumbsdb

public void paintIcon(Component c, Graphics g, int x, int y) {
  ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
  g.setColor(Color.DARK_GRAY);
  g.fillRoundRect(x, y, SIZE, SIZE, 10, 10);
  g.drawImage(image, (SIZE - image.getWidth()) / 2 +  x,  (SIZE - image.getHeight()) / 2 + y, null);
}
origin: stackoverflow.com

 class GridPanel extends JPanel {
  GridPanel() {
    super();
  }

  @Override
  public void paintComponent(Graphics g) {
    super.paintComponent(g);
    g.setColor(Color.decode("#0232ac"));
    g.fillRoundRect(100, 50, 300, 600, 50, 50);
    g.setColor(Color.white);
    g.drawString("TitleonRect", 220, 80);
  }
}
origin: atarw/material-ui-swing

  private void paintBackground (Graphics g, JComponent c) {
    g.setColor (c.getBackground ());
    g.fillRoundRect (0, 0, c.getWidth (), c.getHeight (), 7, 7);
  }
}
origin: stackoverflow.com

 // Draw rectangles
import java.awt.*;
import java.applet.*;

public class Rectangles extends Applet {
  public void paint(Graphics g) {
    g.drawRect(10, 10, 60, 50);
    g.fillRect(100, 10, 60, 50);
    g.drawRoundRect(190, 10, 60, 50, 15, 15);
    g.fillRoundRect(70, 90, 140, 100, 30, 40);
  }
}
origin: com.jidesoft/jide-oss

public void paintCommandBarBackground(JComponent c, Graphics g, Rectangle rect, int orientation, int state) {
  g.setColor(UIDefaultsLookup.getColor("CommandBar.background"));
  g.fillRoundRect(rect.x, rect.y, rect.width, rect.height, 2, 2);
}
origin: org.fudaa.framework.ctulu/ctulu-bu

public void paint(Graphics _g)
{
 super.paint(_g);
 if(drop_)
 {
  Rectangle r=getDropRect();
  _g.setColor(new Color(255,128,0,64));
  _g.fillRoundRect(r.x,r.y,r.width,r.height,9,9);
  _g.setColor(new Color(255,128,0));
  _g.drawRoundRect(r.x,r.y,r.width-1,r.height-1,9,9);
 }
}
origin: edu.toronto.cs.medsavant/medsavant-client

@Override
protected void paintComponent(Graphics g) {
  super.paintComponent(g);
  int w = getWidth();
  int h = getHeight();
  g.setColor(Color.WHITE);
  g.fillRoundRect(0, 0, w - 1, h - 1, 12, 12);
  g.setColor(Color.GRAY);
  g.drawRoundRect(0, 0, w - 1, h - 1, 12, 12);
}
origin: raydac/netbeans-mmd-plugin

@Override
public void paintComponent(@Nonnull final Graphics g) {
 final Dimension size = this.getSize();
 g.setColor(this.getBackground());
 size.width--;
 size.height--;
 final int radius = size.height / 2;
 g.fillRoundRect(0, 0, size.width, size.height, radius, radius);
 g.setColor(this.getBackground().darker().darker());
 g.drawRoundRect(0, 0, size.width, size.height, radius, radius);
 super.paintComponent(g);
}
origin: com.jidesoft/jide-oss

  protected void paintComponent(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;
    Composite orgComposite = g2.getComposite();
    Color orgColor = g2.getColor();
    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.70f));
    Object o = JideSwingUtilities.setupShapeAntialiasing(g);
    g2.setColor(getBackground());
    g.fillRoundRect(1, 1, getWidth() - 2, getHeight() - 2, 1, 1);
    JideSwingUtilities.restoreShapeAntialiasing(g, o);
    g2.setColor(orgColor);
    g2.setComposite(orgComposite);
    super.paintComponent(g);
  }
}
origin: it.tidalwave.netbeans/it-tidalwave-netbeans-swing

 @Override
 public void paint (final Graphics g)
  {
   final Graphics2D g2 = (Graphics2D)g;
   final Object antiAliasingSave = g2.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
   g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
   g.setColor(getBackground());
   g.fillRoundRect(0, 0, getWidth() - 1, getHeight() - 1, radius, radius);
   paintComponents(g);
   g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, antiAliasingSave);
  }
}
java.awtGraphicsfillRoundRect

Javadoc

Fills the specified rounded corner rectangle with the current color. The left and right edges of the rectangle are at x and x + width - 1, respectively. The top and bottom edges of the rectangle are at y and y + height - 1.

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,
  • getClipBounds,
  • setClip,
  • getFont,
  • fillPolygon,
  • fillOval,
  • drawOval,
  • getClip,
  • drawRoundRect

Popular in Java

  • Reactive rest calls using spring rest template
  • putExtra (Intent)
  • startActivity (Activity)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • Best IntelliJ plugins
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