문제

I have a JPanel with a null layout (this should stay), and a simple Etched Border. Now i want to set the location of a button at the deapest point; for this i need the width of the border. How can i get this? Component.insets().bottom works fine, but this method is deprecated. Is there something newer? Thanks!

Edit: sry for my english. And Thanks for downvotingm.. -.-

도움이 되었습니까?

해결책

int base = myComponent.getInsets().bottom;

From the docs

Deprecated. As of JDK version 1.1, replaced by getInsets().

Swing was designed to use layout managers. Definitely better to use one for positioning & sizing components. It should remove the necessity to determine the base location of your component.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top