Question

I am developing a Java application using SWT that contains some buttons with images.

On my Windows machine, the button will automatically be large enough to show the entire image in the button. I tried this on a Mac however the button will not become tall enough to fit the entire image. I tried using the setsize() function on the button to manually set the size however whenever I called layout() on the button's parent it would set the button's size back to its default value.

Any ideas on how to make the button large enough to fit the image?

Was it helpful?

Solution

I found the solution.

The button's parent was using the GridLayout manager. I set the button's gridData variables heightHint and widthHint to the intended size and it worked.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top