About 401,000 results
Open links in new tab
  1. java - Generating gradients programmatically? - Stack Overflow

    In Java, you could use the GradientPaint. In Java 1.6 and up, there is also LinearGradientPaint which allows for more control over how it is painted. See java.sun.com/javase/6/docs/api/java/awt/… You can use the built in GradientPaint class. GradientPaint gp = new GradientPaint(0,0,c1,r.getWidth(),r.getHeight(),c2); . g.setPaint(gp); g.fill(rect);

  2. GradientPaint (Java Platform SE 8 ) - Oracle

    The GradientPaint class provides a way to fill a Shape with a linear color gradient pattern. If Point P1 with Color C1 and Point P2 with Color C2 are specified in user space, the Color on the P1, P2 connecting line is proportionally changed from C1 to C2.

  3. LinearGradientPaint (Java Platform SE 8 ) - Oracle

    The LinearGradientPaint class provides a way to fill a Shape with a linear color gradient pattern. The user may specify two or more gradient colors, and this paint will provide an interpolation between each color.

  4. 4 Color Gradient using Java awt - Stack Overflow

    Jan 29, 2014 · I´m trying to create a 4 color gradient to fill a rectangle. Each corner will have a diferent color. The result image I´m trying to achieve is something like this:

  5. Java Color: Usage Guide for Java.awt.Color Class

    Nov 1, 2023 · One of the ways to use the Color class in Java is to create gradients. Gradients are a smooth transition between two or more colors. In Java, you can create gradients using the GradientPaint class.

  6. How do I create a gradient paint in Java 2D?

    Jun 5, 2023 · To change the color of a graphics shape we can use the setPaint() method. For a simple coloring we can pass the color object into this method, such as Color.RED or Color.GREEN. If you want to paint with a gradient paint you can use the GradientPaint class.

  7. java - How to programmatically create gradient color background

    Jan 9, 2019 · I want to programmatically create linear gradient color background for a myView. The two colors of the gradient are set by variables that will change frequently. So I need to find an optimized way.

  8. JavaFX | LinearGradient Class - GeeksforGeeks

    Sep 19, 2018 · LinearGradient class fills a shape with a linear color gradient pattern. A user may specify more than one LinearGradient pattern and the system will provide interpolation between the colors. Constructors of the class:

  9. Drawing with a Gradient Color : Gradient Paint - Java

    Drawing with a Gradient Color. import java.awt.Color; import java.awt.GradientPaint; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Rectangle; import javax.swing.JComponent; import javax.swing.JFrame; public class BasicDraw { public static void main(String[] args) { new BasicDraw(); } BasicDraw() { JFrame frame = new ...

  10. LinearGradientPaint (Java SE 21 & JDK 21) - Oracle

    The LinearGradientPaint class provides a way to fill a Shape with a linear color gradient pattern. The user may specify two or more gradient colors, and this paint will provide an interpolation between each color.

  11. Some results have been removed
Refresh