CS计算机代考程序代写 Java package uk.ac.liv.comp285.cw1;

package uk.ac.liv.comp285.cw1;

import java.awt.Graphics;
import java.util.Vector;

import javax.swing.JPanel;

@SuppressWarnings(“serial”)
public class PanelCanvas extends JPanel {

private Vector allShapes=new Vector ();

public void addShape(IShape shape) {
allShapes.add(shape);
}

@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);

allShapes.forEach((shape)-> {
shape.render(g);
}
);
}

}