AWT Frame Basics | |||
---|---|---|---|
Concept | JAR | Source |
Description, Comments, Questions |
Graphics Environment |
RevealGE.jar | RevealGE.java | Before developing graphic applications characteristics of the graphics environment should be determined |
Minimal App | Minimal.jar | Minimal.java | The basic AWT application: a full-screen Frame with
a title containing a window component. Set false to true in setUndecorated(false) and rerun the project |
Centered on Screen | Centered.jar | Centered.java | The Frame opens up centered on the host monitor |
Drawing Text | DrawString.jar | DrawString.java | Text is drawn onto the window component (Canvas)
of a Frame. Notice the anchor location of the text at (50,50). Explain why it looks odd but still makes sense. |
Window Metrics 1 | WindowMetrics.jar | WindowMetrics.java | One strategy for determining the dimensions of the Canvas within
a Frame. Monitor the results as you resize the Frame. |
Window Metrics 2 | CanvasStretch.jar | CanvasStretch.java | An alternative strategy for determining the dimensions of the client
rectangle within a Frame. Instantiates and adds a Canvas in the center of the default BorderLayout of the Frame. |
Menus | FrameMenu.jar | FrameMenu.java | The Menu bar is placed under the Title bar, reducing the height of the drawable canvas. Implementation of the ActionListener interface is required for event-handling. |
AWT Rendering | |||
Concept | JAR | Source |
Description and Comments |
Fonts | Fonts.jar | Fonts.java | Polls the Graphics Environment to acquire the array of available fonts and displays the first few in Font.PLAIN, 12pt format. |
Points | Points.jar | Points.java | Adds a mouse listener event handler to identify the location of the point
to be drawn. Points are simply lines that are drawn with identical start and end locations. |
Rectangles | Rectangles.jar | Rectangles.java | Rectangles are drawn with their top left corner defined by the mouse
click. Explain why the height and width are different for each rectangle. |
Ovals | Ovals.jar | Ovals.java | Ovals are actually axis-parallel ellipses defined by rectangles drawn with their centre defined by the mouse click. Where would you have to click for a circle? |
Polylines | Polylines.jar | Polylines.java | Polylines are connected line segments. |
Polygons | Polygons.jar | Polygons.java | The drawPolygon() method closes the sequence of polylines by adding a line segment from the final point to the first point. There are two techniques for rendering a Polygon. |
Filled Graphic Objects | Fills.jar | Fills.java | Display a filled graphic object selected from a popup menu. |
Clipping | Clip.jar | Clip.java | A region (rectangle) can be defined within the drawing canvas that limits the displayed portion of graphic objects using a technique known as clipping. |
Java2D Modeling and Rendering | |||
Concept | JAR | Source |
Description and Comments |
Java2D | J2DHelloWorld.jar | J2DHelloWorld.java | Our first Java2D program |
Point2D | Point2Ds.jar | Point2Ds.java | This program uses the Point2D.Double class to model and render 15 000
pixels. Shrink the frame to the point where the visible canvas is completely covered in pixels |
Line2D | Triangles.jar | Triangle.java | (Modified) example taken from [A:11] demonstrating the use of Line2D.Double objects in constructing a sequence of nested Triangles |
Ellipse2D | Ellipse2Ds.jar | Ellipse2Ds.java | This example demonstrates the use of Ellipse2D.Double objects
by creating a familar trademark logo |
QuadCurve2D | QuadCurve2Ds.jar | QuadCurve2Ds.java | This example provides an interactive demonstration of a QuadCurve2D.Double object using an animation technique known as rubberbanding. |
CubicCurve2D | CubicCurve2Ds.jar | CubicCurve2Ds.java | This example provides an interactive demonstration of a CubicCurve2D.Double object using an animation technique known as rubberbanding. |
DrawShapes | DrawShapes.jar | DrawShapes.java | Listing 2.3 (p. 44) from Computer Graphics Using Java 2D and 3D (Zhang and Liang) |
AreaGeometry | AreaGeometry.jar | AreaGeometry.java | Listing 2.4 (p. 50) from Computer Graphics Using Java 2D and 3D (Zhang and Liang) |
Path2D | CustomPath.jar | CustomPath.java | (Modified) Listing 2.5 (p. 53) from Computer Graphics Using Java 2D and 3D (Zhang and Liang) |
Coordinate Systems | |||
Concept | JAR | Source |
Description and Comments |
Layout Managers | |||
Concept | JAR | Source |
Description and Comments |
BorderLayout | Border.jar | Border.java | BorderLayout is the default layout scheme for a container |
GridLayout | Grid.jar | Grid.java | GridLayout sections the container into rows and columns as in a matrix |
FlowLayout | Flow.jar | Flow.java | FlowLayout adds components to a container as text flows in a paragraph |
CardLayout |