public synchronized void draw(Graphics2D g) {
Window w = s.getFullScreenWindow();
g.setColor(w.getBackground());
g.fillRect(0, 0, s.getWidth(), s.getHeight());
g.setColor(w.getForeground());
for(int x = 0; x<10; x++){
for(int y = 0; y<10; y++){
g.drawRect(x * 32, y * 32, 32,32);
}
}
g.drawString("mouse x: " + mousex, 400, 400);
g.drawString("mouse y: "+ mousey, 400, 420);
}
i want to make it so the grid fills the rectangle in the "for" loop based on a map array. this is what i have but there seems to be an error
public synchronized void draw(Graphics2D g) {
Window w = s.getFullScreenWindow();
g.setColor(w.getBackground());
g.fillRect(0, 0, s.getWidth(), s.getHeight());
g.setColor(w.getForeground());
for(int x = 0; x<10; x++){
for(int y = 0; y<10; y++){
rect = new Rectangle(x * 32, y * 32, 32,32);
g.drawRect(rect.getX(),rect.getY(),rect.getWidth(),rect.getHeight());
}
}
g.drawString("mouse x: " + mousex, 400, 400);
g.drawString("mouse y: "+ mousey, 400, 420);
}
it says im passing in double values when i need int values. any idea?


Sign In
Create Account


Back to top









