Why if i set a width and height of a frame to 400 for example the usable space is smaller and how i can work around it and how i can place someting in the center without the content being cut? Example
public class Main extends JPanel{
static int width = 400;
static int height = 400;
static int arcWidth = 400;
static int arcHeight = 400;
public static void main(String args[]){
JFrame frame = new JFrame();
JFrame mainContent = new JFrame();
Main panel = new Main();
frame.setSize(width, height);
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setTitle("Clock");
frame.add(panel);
frame.setVisible(true);
}
public void paintComponent(Graphics g){
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(
RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g.setColor(Color.BLACK);
g2.setStroke(new BasicStroke(4,BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
g.drawArc(width/2 -arcWidth/2, height/2 - arcHeight/2, arcWidth, arcHeight, 0, 360);
}
}