Question: Consider the SceneEditor.java Explain why the CompoundShape.add method is protected. Explain why CompoundShape.path is private. 01: import java.awt.*; 02: import java.awt.geom.*; 03: import java.awt.event.*; 04:
Consider the SceneEditor.java Explain why the CompoundShape.add method is protected. Explain why CompoundShape.path is private.

01: import java.awt.*; 02: import java.awt.geom.*; 03: import java.awt.event.*; 04: import javax.swing.*; 05 07: A program that allows users to edit a scene composed 08: of items 09: 10: public class SceneEditor 12: public static void main(String[] args) 13: [ JFrame frame new JFrame); 14: 15: 16: 17: 18: 19: 20: 21: frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); final SceneComponent scene new SceneComponent); JButton houseButton new JButton("House"); houseButton.addActionListener(new ActionListener() public void actionPerformed (ActionEvent event) 24: 25 26: 27: 28: 29: scene.add (new HouseShape (20, 20, 50)); JButton carButton new JButton("Car"); carButton.addActionListener(nevw ActionListener) 31: 32: public void actionPerformed (ActionEvent event) 34: 35: 36: 37: 38: 39: 40: scene.add(new CarShape (20, 20, 50)); JButton removeButton new JButton("Remove"); removeButton.addActionListener (new ActionListener( public void actionPerformed (ActionEvent event) 44: 45: 46: 47: 48: 49: scene.removeSelected) JPanel buttonsnew JPanel); buttons.add(houseButton) buttons.add (carButton); buttons.add (removeButton) 51: 52: 53 54: 55: 56: 57: 58: 59: 60: 61: 62: frame.add (scene, BorderLayout.CENTER); frame.add (buttons, BorderLayout. NORTH); frame.setSize(300, 300 frame.setVisible (true)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
