JFrame类中函数中setVisible()或show()函数。
JFrame类中getInsets()函数,获得内容面板边框到JFrame边框的距离。
JPanel类中getWidth()和getHeight()函数,获得面板的宽度和高度。
注意:getInsets()、getWidth()和getHeight()函数必须放在setVisible()或show()函数之后,才能获得正确的像素值,否则获得的结果为0。
JFrame类中函数中setVisible()或show()函数。
JFrame类中getInsets()函数,获得内容面板边框到JFrame边框的距离。
JPanel类中getWidth()和getHeight()函数,获得面板的宽度和高度。
注意:getInsets()、getWidth()和getHeight()函数必须放在setVisible()或show()函数之后,才能获得正确的像素值,否则获得的结果为0。