Show Color Components
To show color components, we have used the class DirectColorModel. The DirectColorModel class shows pixel values that represent RGB color and alpha information and pack into a single int, short, or byte quantity.
Draw a Triangle using a Line2D
To draw a triangle, we are using Line2D class of package java.awt.geom.*. This class provides a line segment in (x, y) coordinate space. We have draw three line segments using the class Line2D to create a triangle.
Show Different Strokes
To give the the impressive and stylistic outline, class BasicStroke is used. The value passed in the constructor of the class BasicStroke shows the thickness of outline.