Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Tetris;
- public class Punto {
- int x,y;
- public void setx(int mix){
- x=mix;
- }
- public void sety(int miy){
- y=miy;
- }
- public int getx(){
- return x;
- }
- public int gety(){
- return y;
- }
- }
- package Tetris;
- import javax.swing.*;
- import java.awt.*;
- public class Cuadro extends JPanel {
- Punto p0,p1;
- Cuadro(int a, int b, int i, int j) {
- p0=new Punto();
- p0.setx(a);
- p0.sety(b);
- p1=new Punto();
- p1.setx(i);
- p1.sety(j);
- }
- public Punto getP0()
- {
- return p0;
- }
- public Punto getP1()
- {
- return p1;
- }
- public void movex(int i)
- {
- p0.setx(i);
- p1.setx(i);
- }
- public void movey(int j)
- {
- p0.sety(j);
- p1.sety(j);
- }
- public Punto getp0()
- {
- return p0;
- }
- public Punto getp1()
- {
- return p1;
- }
- public void paintComponent(Graphics g)
- {
- super.paintComponent(g);
- g.drawRect(p0.getx(), p0.gety(), p1.getx()-p0.getx(), p1.gety()-p0.gety());
- }
- }
Add Comment
Please, Sign In to add comment