This Java tutorial teaches you about adding the rendering hints to a graphics on the frame. The rendering hints uses the Graphics2D and creates the following image.
Description of program:
This program uses the Graphics2D class for rendering hints and draw or construct the given following image.
Description of code:
Graphics2D():
This is the constructor of Graphics2D class that extends the Graphics class
to provide
KEY_ANTIALIASING:
This is an antialiasing hint key.
VALUE_ANTIALIAS_ON:
This is a antialiasing hints values and rendered with it.
setRenderingHint():
This method sets the values in Graphics2D object for rendering algorithm.
GradiantPaint(float x1, float y1, Color col1,
float x2, float y2, Color col2):
This is the constructor of GradiantPaint class that provides a way for
filling the shapes with gradient color pattern. It creates the simple acyclic GradientPaint
object. It takes the following arguments:
x1: This
is the x coordinate of first specified point.
y1: This is the y coordinate
of first specified point.
col1: This is the color of
first specified point.
x2: This is the x coordinate
of second specified point.
y2: This is the y coordinate
of second specified point.
col2: This is the color of
second specified point.
Ellipse2D():
This is the constructor of an abstract class Ellipse2D that defines bounding
rectangle and constructs an ellipse.
transform():
This is the constructor of Transform Class. This is an abstract class that
transform a source tree into a tree result.
Here is the code of program:
import java.awt.*;
|
Output of program:
![]() |
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: Add RenderingHints to a Graphics
Post your Comment