I am having trouble understanding exactly how borders work within the context of a JPanel, especially in regards to using paintComponent. Say I have a JPanel that needs 100x100 of free space to draw and I want a border 10 pixels long on each side; do I have to account for that in my setSize() call? For example, would i do setSize(100,100) or setSize(120, 120)?
And if I want to use paintComponent to draw a rectangle so that it touches the left side of this border, do I need to set the border width as my x-value? I have tried this but it always ends up a few extra pixels to the left. Can anyone give me a definitive explanation on what effect borders have on the absolute positioning of graphics?