Question: Write a comment for each line : import java.awt.Component; import java.awt.Graphics; import java.awt.Image; import java.awt.Rectangle; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; public class ColorableBlocks extends

Write a comment for each line :

import java.awt.Component; import java.awt.Graphics; import java.awt.Image; import java.awt.Rectangle; import java.io.File; import java.io.IOException;

import javax.imageio.ImageIO;

public class ColorableBlocks extends Rectangle {

Image pic; boolean destroyed; int movX,movY;

ColorableBlocks(int x, int y, int w, int h, String s) { this.x = x; this.y = y; movX = 3; movY = 3;

this.width = w; this.height = h; try { pic = ImageIO.read(new File("src/"+s)); } catch (IOException e) { e.printStackTrace(); } }

public void draw(Graphics g, Component c) { if (!destroyed) g.drawImage(pic, x, y, width, height, c); }

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!