Drawing Polygons in Java

Опубликовано: 22 Март 2026
на канале: Cody Henrichsen
15,494
36

Creating Polygon objects, then drawing them on a subpanel in Java. Using Math.random() to assign random sizes and positions to the shapes being drawn on the panel.

Table of Contents:

00:20 - Project structure
04:41 - Building the addTriangle method
08:59 - using paintComponent to draw items in lists
13:43 - Show the addTriangle in action
15:46 - create the addPolygon method
20:15 - draw the members of the polygonList
21:33 - add a button for the addPolygon
22:08 - adjust constraints for the button
23:47 - add a listener for the addPolygonButton
26:59 - clear all the lists
28:00 - create the addEllipse method