Hello everyone!
I use this method:

private void drawRectangles(Graphics g){
        final int ROWS = getHeight() / 75;
        final int COLUMNS = getWidth() / 75;

        for(int i = 0; i < ROWS + 1; i++){
            for(int j = 0; j < COLUMNS + 1; j++){
                int x = j * 75;
                int y = i * 75;

                g.drawRect(x, y, 75, 75);
            }
        }
    }

To draw a a rectangle pattern across my whole window.
And I'm making a map creator, but so far I can only figure out how to make it draw the tile at the exact mouse x & y locations I click. But I want it to draw the 75x75 tile, at the exact x, and y locations at the rectangle I click.

Kind regards,
Benjamin.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.