pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill van Melle <bill.van.me...@gmail.com>
Subject Does ButtonDataRenderer#setFillIcon not work?
Date Wed, 23 Mar 2011 00:33:56 GMT
I'm trying to make a button that shows an image scaled to whatever size the
button is.  Thus, I want the button's internal image view to have fill=true.
 It looks like setFillIcon on the renderer is intended for that, but it
doesn't help.  I'm doing

((ButtonDataRenderer)button.getDataRenderer()).setFillIcon(true);

in the code that creates the button.  Is that not right?

More complete test case:

-- test.bxml --

<Window title="Button Example" maximized="true"
  xmlns:bxml="http://pivot.apache.org/bxml"
  xmlns:content="org.apache.pivot.wtk.content"
  xmlns="org.apache.pivot.wtk">
  <BoxPane>
    <PushButton bxml:id="button" preferredWidth="50" preferredHeight="50">
      <content:ButtonData icon="@test.jpg" />
    </PushButton>
  </BoxPane>
</Window>

-- in the main program --

BXMLSerializer bxmlSerializer = new BXMLSerializer();
Window window = (Window)bxmlSerializer.readObject(Test.class, "test.bxml");
PushButton button = (PushButton)
bxmlSerializer.getNamespace().get("button");
((ButtonDataRenderer)button.getDataRenderer()).setFillIcon(true);



(As an aside, what I really want to do is have an image be a button, which
I'm guessing I'd have to create my own custom control to do.  For a crude
version of that, I tried
setting styles="{borderColor:null,backgroundColor:null}" on the PushButton
above, but the default TerraPushButtonSkin balked at that, unsurprisingly.)

Mime
View raw message