pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Brown <gkbr...@mac.com>
Subject Re: How to dynamically change pushbutton icon?
Date Fri, 14 May 2010 12:27:29 GMT
That works. You can also use a URL. The '@' symbol is translated to a URL internally by the
WTKXSerializer. It allows you to load an image using a path that is relative to the current
WTKX file.

In Java, you can do something similar using Class#getResource(). For example, if the image
file is located in the same directory as your class file, you could do something like this:

((ButtonData)someButton.getButtonData()).setIcon(getClass().getResource("mysecondimage.png"));

This approach is a little more resilient to refactoring, since it doesn't rely on a hard-coded
path. 

On May 13, 2010, at 6:20 PM, JohnRodey wrote:

> 
> Scratch that,  I was able to use the full relative path:
> ((ButtonData)someButton.getButtonData()).setIcon("com/my/path/mysecondimage.png"); 
> -- 
> View this message in context: http://apache-pivot-users.399431.n3.nabble.com/How-to-dynamically-change-pushbutton-icon-tp815958p815983.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.


Mime
View raw message