Drawing.java
上传用户:sdzznc
上传日期:2022-07-23
资源大小:51k
文件大小:1k
- package cn.edu.nju.software.grapheditor;
- import java.awt.Color;
- import java.awt.Graphics;
- import java.awt.Point;
- import java.util.ArrayList;
- import cn.edu.nju.software.grapheditor.shape.Shape;
- public class Drawing {
- public ArrayList<Shape> a=new ArrayList<Shape>();
- public Color currentColor;
- public Drawing(Color initialColor) {
- currentColor=initialColor;
- // Your code goes here
- }
-
- public Shape getFrontmostContainer(Point p) {
- int j;
- Shape shape=null;
- for(j=a.size();j>0;j--){
- if(a.get(j-1).containsPoint(p)){
- shape=a.get(j-1);
- break;
- }
- }
- return shape;
-
- // Your code goes here
-
- }
-
- public void draw(Graphics g) {
- for(int i=0;i<a.size();i++){
- a.get(i).draw(g);// Your code goes here
- }
- }
-
-
-
-
- }