Okay, I created https://issues.apache.org/jira/browse/PIVOT-721
On Thu, Mar 24, 2011 at 5:30 AM, Greg Brown <[email protected]> wrote: > > > I note that setFillIcon has additional problems when the ButtonData > contains text, which this one-liner doesn't fix. Not sure if that's a bug > in BoxPane, ImageView, or a fundamental shortcoming of the measurement > system. > > Could you provide more detail on this? What kind of problems did you see? > If you happen to have a small test case that demonstrates the issue, that > would be great. Sure. It appears that when you tell an ImageView to scale down to a particular height, it still reports its width as being the width of the original image. I'll illustrate without using PushButton, so that we don't have to worry about implementing the fix described above. The default button is a BoxPane containing an ImageView and a Label, so mimic it like this: <Window xmlns="org.apache.pivot.wtk"> <BoxPane styles="{fill:true, verticalAlignment:'center'}" preferredHeight="100"> <ImageView image="@test.jpg" styles="{fill:true}" /> <Label text="Label" /> </BoxPane> </Window> If you pick test.jpg to be an image significantly larger than 100x100, you'll see that the space allocated for the image is still the original width of the image. Also note that if you pick an image significantly *smaller* than 100x100, it is not scaled up. Is that a bug, or does there have to be a width constraint as well to make that happen? Also in this example, the Label isn't centered. That's not a bug -- it's because BoxPane ignores the verticalAlignment when fill is true. Need to move that style to the children, which makes the ButtonDataRenderer fix a little more than the one-liner I suggested. All these observations are also true in the other orientation (vertical BoxPane with a preferred width).
