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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started