Title: Java Eclipse - JFrame 3
Description: We continue our discussion of frames. In the first part of this video, we draw rectangles, ellipses and circles. we construct a for loop. Within the loop, we create a rectangle object and we draw it on the screen. We also create an ellipse which is framed within the rectangle. Inside the loop we manipulated the coordinates of the rectangle so its location is changing in every iteration (so is the location of the ellipse). Then we show off the ability of changing colors and fonts before drawing more shapes. We used the setPaint method to change the color to red. Then we draw a rectangle and an ellipse. Finally, we created a new Font (serif, bold, and size 20). We set the graphics font to this font and draw a string on the screen.
Methodology: Good coding standards and object-oriented design.
Technologies: Java, object-oriented programming
Examples constructed: The first example shows how to create shapes on the component. We create multiple rectangles and ellipses within a loop. Then, we show how to change colors and fonts before drawing some more shapes on the screen.
Keywords: class, JFrame, EventQueue, Runnable, main, EXIT_ON_CLOSE, JComponent, paintComponent, Graphics, Graphics2D.