congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
GradientPaint.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
java.awt.GradientPaint
constructor

Best Java code snippets using java.awt.GradientPaint.<init> (Showing top 20 results out of 1,845)

Refine searchRefine arrow

  • Graphics2D.setPaint
  • Color.<init>
  • Container.add
origin: libgdx/libgdx

  protected void paintComponent (Graphics graphics) {
    Graphics2D g = (Graphics2D)graphics;
    int width = getWidth() - 1;
    int height = getHeight() - 1;
    for (int i = 0, n = paletteColors.length - 1; i < n; i++) {
      Color color1 = paletteColors[i];
      Color color2 = paletteColors[i + 1];
      float point1 = i / (float)n * width;
      float point2 = (i + 1) / (float)n * width;
      g.setPaint(new GradientPaint(point1, 0, color1, point2, 0, color2, false));
      g.fillRect((int)point1, 0, (int)Math.ceil(point2 - point1), height);
    }
    g.setPaint(null);
    g.setColor(Color.black);
    g.drawRect(0, 0, width, height);
  }
}
origin: runelite/runelite

private void redrawGradient()
{
  Color primaryRight = Color.getHSBColor(1f - this.selectedY / (float) (size - 1), 1, 1);
  Graphics2D g = image.createGraphics();
  GradientPaint primary = new GradientPaint(
    0f, 0f, Color.WHITE,
    size - 1, 0f, primaryRight);
  GradientPaint shade = new GradientPaint(
    0f, 0f, new Color(0, 0, 0, 0),
    0f, size - 1, Color.BLACK);
  g.setPaint(primary);
  g.fillRect(0, 0, size, size);
  g.setPaint(shade);
  g.fillRect(0, 0, size, size);
  g.dispose();
  forceRedraw = true;
}
origin: stackoverflow.com

  BufferedImage.TYPE_INT_RGB);
Graphics2D imageGraphics = image.createGraphics();
GradientPaint gp = new GradientPaint(
  20f,
  20f,
  280f,
  Color.orange);
imageGraphics.setPaint(gp);
imageGraphics.fillRect(0, 0, 400, 300);
  BufferedImage.TYPE_INT_ARGB);
Graphics g = bi.createGraphics();
g.setColor(new Color(255, 255, 255, 128));
g.fillRoundRect(
  0,
JLabel imageLabel = new JLabel(ii);
f.getContentPane().add(imageLabel);
f.pack();
f.setLocationByPlatform(true);
origin: jfree/jfreechart

/**
 * Constructs a new renderer with default values for the bar colors.
 */
public WaterfallBarRenderer() {
  this(new GradientPaint(0.0f, 0.0f, new Color(0x22, 0x22, 0xFF),
      0.0f, 0.0f, new Color(0x66, 0x66, 0xFF)),
      new GradientPaint(0.0f, 0.0f, new Color(0x22, 0xFF, 0x22),
      0.0f, 0.0f, new Color(0x66, 0xFF, 0x66)),
      new GradientPaint(0.0f, 0.0f, new Color(0xFF, 0x22, 0x22),
      0.0f, 0.0f, new Color(0xFF, 0x66, 0x66)),
      new GradientPaint(0.0f, 0.0f, new Color(0xFF, 0xFF, 0x22),
      0.0f, 0.0f, new Color(0xFF, 0xFF, 0x66)));
}
origin: stackoverflow.com

plafComponents.add(plafChooser);
plafComponents.add(pack);
gui.add(plafComponents, BorderLayout.NORTH);
  200,200,BufferedImage.TYPE_INT_ARGB);
Graphics2D g = bi.createGraphics();
GradientPaint gp = new GradientPaint(
  20f,20f,Color.red, 180f,180f,Color.yellow);
g.setPaint(gp);
g.fillRect(0,0,200,200);
ImageIcon ii = new ImageIcon(bi);
origin: stackoverflow.com

    xp = new int[]{x, x, x + w, x + w, x};
    yp = new int[]{y, y + h - 3, y + h - 3, y, y};
    gradientShadow = new GradientPaint(x, y, new Color(100, 100, 255), x, y + h, Color.ORANGE);
    break;
  case RIGHT:
    xp = new int[]{x, x, x + w - 2, x + w - 2, x};
    yp = new int[]{y, y + h - 3, y + h - 3, y, y};
    gradientShadow = new GradientPaint(x, y, new Color(100, 100, 255), x, y + h, new Color(153, 186, 243));
    break;
  case BOTTOM:
    xp = new int[]{x, x, x + 3, x + w - inclTab - 6, x + w - inclTab - 2, x + w - inclTab, x + w - 3, x};
    yp = new int[]{y, y + h - 3, y + h, y + h, y + h - 1, y + h - 3, y, y};
    gradientShadow = new GradientPaint(x, y, new Color(100, 100, 255), x, y + h, Color.BLUE);
    break;
  case TOP:
    xp = new int[]{x, x, x + 3, x + w - inclTab - 6, x + w - inclTab - 2, x + w - inclTab, x + w - inclTab, x};
    yp = new int[]{y + h, y + 3, y, y, y + 1, y + 3, y + h, y + h};
    gradientShadow = new GradientPaint(0, 0, Color.ORANGE, 0, y + h / 2, new Color(240, 255, 210));
    break;
if (isSelected) {
  g2D.setColor(selectColor);
  g2D.setPaint(gradientShadow);
} else {
  if (tabPane.isEnabled() && tabPane.isEnabledAt(tabIndex)) {
    g2D.setColor(deSelectColor);
    GradientPaint gradientShadowTmp = new GradientPaint(0, 0, new Color(255, 255, 200), 0, y + h / 2, new Color(240, 255, 210));
    g2D.setPaint(gradientShadowTmp);
origin: stackoverflow.com

frame.add(tip1Null, BorderLayout.CENTER);
frame.setLocation(150, 150);
frame.setPreferredSize(new Dimension(310, 75));
final Color color1 = new Color(230, 255, 255, 0);
final Color color2 = new Color(255, 230, 255, 64);
final Color alphaColor = new Color(200, 200, 230, 64);
final Color color3 = new Color(
  alphaColor.getRed(), alphaColor.getGreen(), alphaColor.getBlue(), 0);
super.paint(g, c);
Graphics2D g2D = (Graphics2D) g;
GradientPaint gradient1 = new GradientPaint(
  0.0F, (float) c.getHeight() / (float) 2, color1, 0.0F, 0.0F, color2);
Rectangle rec1 = new Rectangle(0, 0, c.getWidth(), c.getHeight() / 2);
g2D.setPaint(gradient1);
g2D.fill(rec1);
GradientPaint gradient2 = new GradientPaint(
  0.0F, (float) c.getHeight() / (float) 2, color3, 0.0F, c.getHeight(), color4);
Rectangle rec2 = new Rectangle(0, c.getHeight() / 2, c.getWidth(), c.getHeight());
g2D.setPaint(gradient2);
g2D.fill(rec2);
origin: org.codehaus.jtstand/jtstand-chart

/**
 * Constructs a new renderer with default values for the bar colors.
 */
public WaterfallBarRenderer() {
  this(new GradientPaint(0.0f, 0.0f, new Color(0x22, 0x22, 0xFF),
      0.0f, 0.0f, new Color(0x66, 0x66, 0xFF)),
      new GradientPaint(0.0f, 0.0f, new Color(0x22, 0xFF, 0x22),
      0.0f, 0.0f, new Color(0x66, 0xFF, 0x66)),
      new GradientPaint(0.0f, 0.0f, new Color(0xFF, 0x22, 0x22),
      0.0f, 0.0f, new Color(0xFF, 0x66, 0x66)),
      new GradientPaint(0.0f, 0.0f, new Color(0xFF, 0xFF, 0x22),
      0.0f, 0.0f, new Color(0xFF, 0xFF, 0x66)));
}
origin: libgdx/libgdx

  protected void paintComponent (Graphics graphics) {
    Graphics2D g = (Graphics2D)graphics;
    int width = getWidth() - 1;
    int height = getHeight() - 1;
    for (int i = 0, n = paletteColors.length - 1; i < n; i++) {
      Color color1 = paletteColors[i];
      Color color2 = paletteColors[i + 1];
      float point1 = i / (float)n * width;
      float point2 = (i + 1) / (float)n * width;
      g.setPaint(new GradientPaint(point1, 0, color1, point2, 0, color2, false));
      g.fillRect((int)point1, 0, (int)Math.ceil(point2 - point1), height);
    }
    g.setPaint(null);
    g.setColor(Color.black);
    g.drawRect(0, 0, width, height);
  }
}
origin: stackoverflow.com

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(new FlowLayout());
frame.add(JGradientButton.newInstance());
frame.setSize(new Dimension(300, 150)); // used for demonstration
protected void paintComponent(Graphics g) {
  final Graphics2D g2 = (Graphics2D) g.create();
  g2.setPaint(new GradientPaint(
      new Point(0, 0), 
      Color.WHITE, 
origin: magefree/mage

g2.setColor(Color.BLACK);
Paint paint = g2.getPaint();
g2.setPaint(new GradientPaint(0, 0, new Color(0x818a9b), 0, height, new Color(0x3a4252)));
g2.fill(casing);
g2.setPaint(paint);
g2.setPaint(new GradientPaint(0, 0, new Color(0x818a9b), 0, height, new Color(0x3a4252)));
g2.fill(casing);
g2.setPaint(paint);
origin: stackoverflow.com

imageLabel = new JLabel(new ImageIcon(convertToFromBytes(getImage())));
memory = new JProgressBar(0, (int) Runtime.getRuntime().maxMemory());
p.add(imageLabel, BorderLayout.CENTER);
p.add(memory, BorderLayout.SOUTH);
JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
GradientPaint gp = new GradientPaint(0f, 0f, new Color(127 + random.nextInt(128), 127 + random.nextInt(128), 127 + random.nextInt(128)),
    (float) halfScreenSize.width, (float) halfScreenSize.width, new Color(random.nextInt(128), random.nextInt(128), random.nextInt(128)));
BufferedImage bi = new BufferedImage(halfScreenSize.width, halfScreenSize.height, BufferedImage.TYPE_INT_RGB);
Graphics2D g2d = bi.createGraphics();
g2d.setPaint(gp);
g2d.fillRect(0, 0, halfScreenSize.width, halfScreenSize.height);
g2d.setFont(bigFont);
origin: jrtom/jung

 public Paint apply(N v) {
  float alpha = transparency.get(v).floatValue();
  if (pi.isPicked(v)) {
   return new Color(1f, 1f, 0, alpha);
  } else {
   if (seed_coloring && seedNodes.contains(v)) {
    Color dark = new Color(0, 0, dark_value, alpha);
    Color light = new Color(0, 0, light_value, alpha);
    return new GradientPaint(0, 0, dark, 10, 0, light, true);
   } else {
    return new Color(1f, 0, 0, alpha);
   }
  }
 }
}
origin: libgdx/libgdx

  protected void paintComponent (Graphics graphics) {
    Graphics2D g = (Graphics2D)graphics;
    int width = getWidth() - 1;
    int height = getHeight() - 1;
    for (int i = 0, n = paletteColors.length - 1; i < n; i++) {
      Color color1 = paletteColors[i];
      Color color2 = paletteColors[i + 1];
      float point1 = i / (float)n * width;
      float point2 = (i + 1) / (float)n * width;
      g.setPaint(new GradientPaint(point1, 0, color1, point2, 0, color2, false));
      g.fillRect((int)point1, 0, (int)Math.ceil(point2 - point1), height);
    }
    g.setPaint(null);
    g.setColor(Color.black);
    g.drawRect(0, 0, width, height);
  }
}
origin: stackoverflow.com

gui.add(quality, BorderLayout.WEST);
dithering = new JCheckBox("Dithering", false);
controls.add(antialiasing);
controls.add(fractionalMetrics);
GradientPaint gp = new GradientPaint(
  0f, 0f, Color.red,
  (float)width, (float)height, Color.orange);
g2d.setPaint(gp);
g2d.fillRect(0,0, width, height);
origin: haraldk/TwelveMonkeys

protected BufferedImage createImage(final int pWidth, final int pHeigth, final int pType) {
  BufferedImage image = new BufferedImage(pWidth, pHeigth, pType);
  Graphics2D g = image.createGraphics();
  try {
    g.setPaint(new GradientPaint(0, 0, Color.RED, pWidth, pHeigth, new Color(0x00000000, true)));
    g.fillRect(0, 0, pWidth, pHeigth);
  }
  finally {
    g.dispose();
  }
  return image;
}
origin: stackoverflow.com

private Color pInterfaceColour = new Color(255, 245, 62);
protected int iDegreeWhite = 180;
protected int iDegreeBlack = 0;
       RenderingHints.KEY_ANTIALIASING,
       RenderingHints.VALUE_ANTIALIAS_ON);
    GradientPaint pGradient = new GradientPaint(0, 0, new Color(255,
       255, 255, iDegreeWhite), 0, getHeight(), new Color(0, 0, 0,
       iDegreeBlack));
    pGraphicsGradientRender.setPaint(pGradient);
    pGraphicsGradientRender.fillRect(0, 0, getWidth(), getHeight());
    super.paintComponent(pGraphics);
 pGradientPane.setPreferredSize(new Dimension(iWidth - 16, iHeight - 62));
 add(pGradientPane);
origin: de.sciss/scisslib

public static GradientPanel createGradientPanel()
{
  final GradientPanel		gp		= new GradientPanel();
  final LookAndFeel		laf		= UIManager.getLookAndFeel();
  final boolean			isAqua	= laf == null ? false : laf.getID().equals( "Aqua" );
  final GradientPaint		grad	= isAqua ? new GradientPaint( 0f, 0f, new Color( 0xF3, 0xF3, 0xF3 ), 0f, 69f, new Color( 0xC4, 0xC4, 0xC4 )) : null;
  gp.setLayout( new BoxLayout( gp, BoxLayout.X_AXIS ));
  gp.setGradient( grad );
  gp.setBorder( BorderFactory.createEmptyBorder( 2, 2, 2, 2 ));
  return gp;
}
origin: libgdx/libgdx

  protected void paintComponent (Graphics graphics) {
    Graphics2D g = (Graphics2D)graphics;
    int width = getWidth() - 1;
    int height = getHeight() - 1;
    for (int i = 0, n = paletteColors.length - 1; i < n; i++) {
      Color color1 = paletteColors[i];
      Color color2 = paletteColors[i + 1];
      float point1 = i / (float)n * width;
      float point2 = (i + 1) / (float)n * width;
      g.setPaint(new GradientPaint(point1, 0, color1, point2, 0, color2, false));
      g.fillRect((int)point1, 0, (int)Math.ceil(point2 - point1), height);
    }
    g.setPaint(null);
    g.setColor(Color.black);
    g.drawRect(0, 0, width, height);
  }
}
origin: stackoverflow.com

private static final Color gradientEndingColor = new Color(0xc0c0c0);
private static final Color borderColor = new Color(0x736a60);
private static final Color disabledBorderColor = new Color(0xbebebe);    
    gradient = new GradientPaint(0.0f, 0.0f, Color.WHITE, 0.0f, h, gradientEndingColor);
  g2d.setPaint(gradient);
  g2d.setComposite(transparent);
  g2d.fillRect(1, 1, w - 1, (h >> 1));
java.awtGradientPaint<init>

Popular methods of GradientPaint

  • getColor1
  • getColor2
  • getPoint1
  • getPoint2
  • isCyclic
  • getTransparency
  • createContext

Popular in Java

  • Start an intent from android
  • setContentView (Activity)
  • startActivity (Activity)
  • setScale (BigDecimal)
  • Kernel (java.awt.image)
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • Iterator (java.util)
    An iterator over a sequence of objects, such as a collection.If a collection has been changed since
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • Github Copilot alternatives
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