J
AVA
Abstract Window Toolkit
(part 2: Graphics2D)
IS311 Programming Concepts
Graphics2D
เป่น subclass ของ Graphics เพิ้มความสามารถ ในการควบคูมรฺปทรงเรขาคณีตที้ซาบซ๊อนมากขึ๊น เช้น
– Draw lines of any thickness – Fill shapes with gradients and textures – Move, rotate, scale, and shear text and graphics – Composite overlapping text and graphics
Drawing Shapes
- Old AWT way (can still use)
– drawXxxx – fillXxxx
- OR - Create a Shape object and the draw
- r fill
Shape Interface
- To draw, use things that implement Shape such
as:
– Area – CubicCurve2D – GeneralPath – Line2D – Polygon – QuadCurve2D – Rectangle – RectangularShape
- These use double's or float's for parameters