質問

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