Your question is confused: JPanels do not have window headers or borders; they are abstract containers that are INSIDE JFrames. JFrames are objects with window headers and borders.
JPanel.getSize() should work as expected. However, for JFrames you will want to use JFrame.getContentPane().getSize() because getContentPane() returns a JPanel (which is the actual content area).
donnyton
source share