i dont know how to do this one, i have the imageIcon Add each of the { Ball, Box
ID: 3590937 • Letter: I
Question
i dont know how to do this one, i have the imageIcon
Add each of the {Ball, Box, Pyramid, Cylinder, Hexagon} object classes to your project, such that each is defined as a child of Shape and implements the Drawable interface, with at least the following:
an optional (javax.swing.)ImageIcon (e.g., named image)
Note: You can use Lab Project 9.3 as a reference on using ImageIcons
a constructor with parameters for the x- and y-coordinate that:
calls the Shape constructor to initialize the x and y coordinates
optionally initializes the image to a new ImageIcon with the image path drawing_thing/images + shape_file,
where shape_file is one of {"greenBall.png", "box.png", "redPyramid.png", "purpleCylinder.png", "gold_hexagon.png"}
the member method public void draw(java.awt.Graphics g) that overrides the Drawable draw method and draws either:
a filled shape of the appropriate color, or
(optional) the image member variable
Explanation / Answer
Can't find the Drawable interface but created the Shape class and sample initiliasation of Cylinder class.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.