JLayeredPane이 있고 JLayeredPane 내부에 JInternalFrame이 있습니다. 필요한 것은 JInternalFrame의 내용 창 경계 (x 위치, y 위치, 너비, 높이)입니다. 경계는 JLayeredPane에 관련 지을 필요가 있습니다. 내 문제는 테두리, 제목 표시 줄 및 JInternalFrame 다른 내 계산 난장판 모르겠어요. 몇 픽셀 떨어져있어.Java에서 구성 요소의 좌표 가져 오기
어떻게 계산하려고합니까? 이 코드는 JInternalFrame에 있습니다.
Rectangle area = new Rectangle(
getX() + 2, //The x coordinate of the JInternalFrame + 2 for the border
getY() + ((javax.swing.plaf.basic.BasicInternalFrameUI) getUI()).getNorthPane().getHeight(), //The Y position of the JinternalFrame + theheight of the title bar of the JInternalFrame
getContentPane().getWidth() - 2, //The width of the Jinternals content pane - the border of the frame
getContentPane().getHeight() //the height of the JinternalFrames content pane
);
내부 프레임의 내용 창 위치를 가져와야합니다.
매우 근사합니다. 나는 이것을 할 수있는 간단한 방법이 있음을 알고있었습니다. 이것은 완벽하게 작동했습니다. – user489041