Demos and Usage of java.awt.Graphics2D.setPaint(Paint paint)


   1: import java.awt.Dimension;
   2: import java.awt.Graphics2D;
   3: import java.awt.Point;
   4:         ...
   5: 
   6:   public void paint(Graphics2D g) {
   7:     int x = (int)this.startPoint.getX();
   8:         ...
   9:     int y = (int)this.startPoint.getY();
  10:     g.setPaint(BACKGROUND_COLOR);
  11:     g.fillRect(x, y, SIDE, SIDE);
  12:         ...
  13:     g.setPaint(BORDER_COLOR);

View Full Code Here
   1: import java.awt.Composite;
   2: import java.awt.Graphics2D;
   3: import java.awt.Paint;
   4:         ...
   5: 
   6:     public void paint (Graphics2D g) {
   7:         if (!isVisible()) {
   8:         ...
   9:         } else if (obj instanceof Color) {
  10:         g.setPaint((Paint) obj);
  11:         } else if (obj instanceof Stroke) {

View Full Code Here
   1: 
   2: import java.awt.Graphics2D;
   3: import java.awt.Image;
   4:         ...
   5:             ((int)(imageWidthPt * scale), (int)(imageHeightPt * scale));
   6:     final Graphics2D g2 = (Graphics2D) image.getGraphics();
   7: 
   8:         ...
   9:     {
  10:       g2.setPaint(extPaint);
  11:     }
  12:         ...
  13:     {
  14:       g2.setPaint((Paint) style.getStyleProperty(ElementStyleSheet.PAINT));

View Full Code Here
   1: import java.awt.Color;
   2: import java.awt.Graphics2D;
   3: import java.awt.Paint;
   4:         ...
   5:     
   6:     public void drawItem(Graphics2D g2,
   7:                          CategoryItemRendererState state,
   8:         ...
   9:         Paint itemPaint = getItemPaint(row, column);
  10:         g2.setPaint(itemPaint);
  11:         g2.fill(bar);
  12:         ...
  13:             if (itemPaint instanceof Color) {
  14:                 g2.setPaint(((Color) itemPaint).darker());

View Full Code Here
   1:     BufferedImage im = ((TerpPaint)this.getParent()).center.getBufferedImage();
   2:     Graphics2D g2d = im.createGraphics();
   3: 
   4:         ...
   5:     g2d.setPaint(((TerpPaint)this.getParent()).center.left_color);
   6:     int style = Font.PLAIN;
   7:         ...
   8:         g2d = im.createGraphics();
   9:         g2d.setPaint(((TerpPaint)this.getParent()).center.left_color);
  10:         FontRenderContext rend = new FontRenderContext(new AffineTransform(),true,true);

View Full Code Here
   1:     BufferedImage im = ((TerpPaint)this.getParent()).center.getBufferedImage();
   2:     Graphics2D g2d = im.createGraphics();
   3: 
   4:         ...
   5:     g2d.setPaint(((TerpPaint)this.getParent()).center.left_color);
   6:     int style = Font.PLAIN;
   7:         ...
   8:         g2d = im.createGraphics();
   9:         g2d.setPaint(((TerpPaint)this.getParent()).center.left_color);
  10:         FontRenderContext rend = new FontRenderContext(new AffineTransform(),true,true);

View Full Code Here
   1: import java.awt.Color;
   2: import java.awt.Graphics2D;
   3: import java.awt.Paint;
   4:         ...
   5:     
   6:     public void drawItem(Graphics2D g2,
   7:                          CategoryItemRendererState state,
   8:         ...
   9:         Paint itemPaint = getItemPaint(row, column);
  10:         g2.setPaint(itemPaint);
  11:         g2.fill(bar);
  12:         ...
  13:                 if (itemPaint instanceof Color) {
  14:                     g2.setPaint(((Color) itemPaint).darker());

View Full Code Here
   1: 
   2: import java.awt.Graphics2D;
   3: import java.awt.Image;
   4:         ...
   5:             imageHeight);
   6:     final Graphics2D g2 = (Graphics2D) image.getGraphics();
   7: 
   8:         ...
   9:     {
  10:       g2.setPaint(extPaint);
  11:     }
  12:         ...
  13:     {
  14:       g2.setPaint((Paint) style.getStyleProperty(ElementStyleSheet.PAINT));

View Full Code Here
   1: import java.awt.FontMetrics;
   2: import java.awt.Graphics2D;
   3: import java.awt.Image;
   4:         ...
   5: {
   6:   private Graphics2D g2;
   7: 
   8:         ...
   9: 
  10:   private static Graphics2D dummyGraphics;
  11: 
  12:         ...
  13:       target.setFont(myfont);
  14:       target.setPaint(mypaint);

View Full Code Here
   1: import java.awt.Composite;
   2: import java.awt.Graphics2D;
   3: import java.awt.Image;
   4:         ...
   5: 
   6:     public void drawBackground(Graphics2D g2, CategoryPlot plot, Rectangle2D dataArea) {
   7: 
   8:         ...
   9:         if (backgroundPaint != null) {
  10:             g2.setPaint(backgroundPaint);
  11:             g2.fill(clip);
  12:         ...
  13:         leftWall.closePath();
  14:         g2.setPaint(getWallPaint());

View Full Code Here
   1: import java.awt.Graphics;
   2: import java.awt.Graphics2D;
   3: import java.awt.BasicStroke;
   4:         ...
   5:         super.paintComponent(g);
   6:         final Graphics2D gr=(Graphics2D) g;
   7:         final double buffer[]=new double[6];
   8:         ...
   9:         if (boundsVisible) {
  10:             gr.setPaint(BOUNDS_COLOR);
  11:             for (int i=0; i<shapes.length; i++) {
  12:         ...
  13:                 final Shape shape=toShape((Point2D) object);
  14:                 gr.setPaint(POINT_COLOR);

View Full Code Here
   1: 
   2:   protected void drawVertices(Graphics2D g2d) {
   3:     if(getNormalMode()) return;
   4:         ...
   5: 
   6:     g2d.setPaint(CORNER_COLOR);
   7:     for(int i=0;i<m_VerticesCorner.length;i++) {
   8:         ...
   9:     }
  10:     g2d.setPaint(CORNER_BD_COLOR);
  11:     for(int i=0;i<m_VerticesCorner.length;i++) {
  12:         ...
  13: 
  14:     g2d.setPaint(MIDDLE_COLOR);

View Full Code Here
   1: import java.awt.GradientPaint;
   2: import java.awt.Graphics2D;
   3: import java.awt.Paint;
   4:         ...
   5: 
   6:     final Graphics2D g2 = writer.getDirectContent().createGraphics(urx, ury, fontSupport);
   7:         ...
   8:     g2.setPaint(getPaint());
   9:     g2.setStroke(getStroke());
  10:         ...
  11: 
  12:     final Graphics2D g2 = writer.getDirectContent().createGraphics(urx, ury, fontSupport);

View Full Code Here
   1: import java.awt.Graphics;
   2: import java.awt.Graphics2D;
   3: import java.awt.Image;
   4:         ...
   5: 
   6:                 Graphics2D g2 = bimg.createGraphics();
   7:                 g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, 
   8:         ...
   9:             public void step(int w, int h);
  10:             public void render(int w, int h, Graphics2D g2);
  11:             public int getBegin();
  12:         ...
  13:                 if (paint != null) {
  14:                     g2.setPaint(paint);

View Full Code Here