This control will have a list of images that will be displayed
{% code title="Example Code" %}
import totalcross.io.IOException;
import totalcross.sys.Settings;
import totalcross.ui.ImageList;
import totalcross.ui.MainWindow;
import totalcross.ui.image.Image;
import totalcross.ui.image.ImageException;
public class ImageList extends MainWindow {
public ImageList(){
setUIStyle(Settings.Material);
}
@Override
public void initUI() {
try {
ImageList imageList = new ImageList();
imageList.add(new Image("images/logo.png"));
imageList.add(new Image("images/insta_icon.png"));
add(imageList, LEFT, TOP);
} catch (ImageException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
{% endcode %}
{% hint style="warning" %} Do not forget to create a folder called "images" inside /src/main/resources and save the images inside it [images]. {% endhint %}
Type | Name | Description |
---|---|---|
Constructor | ImageList() | Create a new instance |
Constructor | ImageList(Object[] items) | Create a new instance already with a filled array |
int | getPreferredWidth() | Returns the preferred Width |
int | getPreferredHeight() | Returns the preferred height |
- See the Java Docs for more information.