Center Align a rectangle in Java Frame/Panel [closed]
Basically, you draw what ever you want around the center of the component, based on it’s width and height public void paintComponent(Graphics g) { super.paintComponent(g); int width = getWidth() – 1; int height = getHeight() – 2; g.drawLine(width / 2, 0, width / 2, height); g.drawLine(0, height / 2, width, height / 2); } Check … Read more