-
Notifications
You must be signed in to change notification settings - Fork 0
/
block.java
30 lines (30 loc) · 1.1 KB
/
block.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package build;
import javax.swing.*;
import java.awt.*;
import java.awt.geom.*;
class block extends JComponent{
int x, y;
int six = 10, siy = 10;
Color c;
// Tells the block if it is a filling block or a normal block
boolean filling = false;
Rectangle2D.Float r = new Rectangle2D.Float();
block(int inpx, int inpy, Color color, boolean filler){
setSize(jfm.dx, jfm.dy);
x = inpx;
y = inpy;
c = color;
filling = filler;
}
// Only used if the block is a filling block
void changeSize(int sispx, int sispy){
six = sispx;
siy = sispy;
}
public void paintComponent(Graphics co){
Graphics2D g = (Graphics2D) co;
r.setFrame(x+jfm.refx,y+jfm.refy,six,siy);
g.setColor(c);
g.fill(r);
}
}