View RSS Feed

Java AWT

Drawing Geometric Primitives

Rate this Entry
by , 03-06-2012 at 07:43 PM (588 Views)
Several classes are provided in the Java 2D API that defines common geometric object like:
  • Points
  • Lines
  • Curves
  • Rectangles


These geometry classes are part of the java.awt.geom package.

To retrieve methods from the path, the PathIterator interface defines and provides methods. For describing and inspecting geometric path objects, the Shape interface provides a set of methods. The GeneralPath class implements this interface and other geometry classes.

All the geometries are created using java.awt.geom package and then rendered using the Graphics2D class. To start with it, you need to get an object f Graphics2D. Following piece of code explains a paint method.
Java Code:
public void paint (Graphics g) {
    Graphics2D g2 = (Graphics2D) g;
    ...
}

Submit "Drawing Geometric Primitives" to Facebook Submit "Drawing Geometric Primitives" to Digg Submit "Drawing Geometric Primitives" to del.icio.us Submit "Drawing Geometric Primitives" to StumbleUpon Submit "Drawing Geometric Primitives" to Google

Categories
Graphics

Comments