Java: JPanel - Example
This page discusses - Java: JPanel - Example.
Images - ImageIcon
This simple approach loads the image "synchronously", meaning that whenever you request an image to be loaded, the program waits until the image loading is finished..
Antialiasing
Antialiased versus Aliased Graphics.
Graphics2D
The javax.swing.Graphics2D class of Java 2 supports many more graphics operations than the Graphics class..
JPanel - Drawing Area 2
To initialize the panel -- Constructor.
JPanel - Drawing Area
Define a new class that extends JPanel and define a paintComponent method in it..
Images - BufferedImage
You can create a new BufferedImage using either the characteristics of an existing component ..
Polygons
Use the addPoint(int xcoord, int ycoord) method to add one point to the polygon..
Color
Predefines a few color constants.
Who calls paintComponent
you subclass JPanel to draw graphics, override the paintComponent() method..
Graphics class
The Graphics class contains drawing methods..
Screen Coordinates
You known the Screen Coordinates.
Drawing
It is easy to use, and can be used with the Color class to set the drawing color and Font class to set the font for drawing text..