It will work fine if JFrame
is re-sizable also.
for (int i = 0; i < 4; i++) {
g.drawLine(i * width, 0, i * width, getHeight());
}
for (int i = 0; i < 11; i++) {
g.drawLine(0, i * height, getWidth(), i * height);
}
--EDIT--
complete code to set the oval also in the center of last row
int ovalSize = 0;
if (width < height) {
ovalSize = width;
} else {
ovalSize = height;
}
int center = (width - ovalSize) / 2;
for (int i = 0; i < 4; i++) {
g.drawLine(i * width, 0, i * width, getHeight());
g.drawOval(i * width + center, height * 10, ovalSize, ovalSize);
}
for (int i = 0; i < 11; i++) {
g.drawLine(0, i * height, getWidth(), i * height);
}
screenshot: