문제

I want to resize an image inside a JGoodies form layout according to the size the cell has, i.e. so that the image fits perfectly in the cell. If I understand correctly, there is no real component for the cell, the size is known only implicitly by the layout manager, right? Any ideas?

도움이 되었습니까?

해결책

As suggested by kleopatra I found this solution: The image is put inside a scrollPane and I get the viewable size of the cell by

javax.swing.JComponent.getVisibleRect().getWidth();

where the JPanel is a JComponent... I can't paste more code directly, as we use other frameworks that wrap Swing and I didn't test that directly, sorry. If somebody else has this problem and uses this solution please add low level Swing code, thanks.

Thanks for your suggestions!

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