Search…
ImageList

Overview

This control will have a list of images that will be displayed

Source Code

Example Code
1
import totalcross.io.IOException;
2
import totalcross.sys.Settings;
3
import totalcross.ui.ImageList;
4
import totalcross.ui.MainWindow;
5
import totalcross.ui.image.Image;
6
import totalcross.ui.image.ImageException;
7
8
public class ImageList extends MainWindow {
9
10
public ImageList(){
11
setUIStyle(Settings.Material);
12
}
13
14
@Override
15
public void initUI() {
16
17
try {
18
ImageList imageList = new ImageList();
19
imageList.add(new Image("images/logo.png"));
20
imageList.add(new Image("images/insta_icon.png"));
21
22
add(imageList, LEFT, TOP);
23
} catch (ImageException e) {
24
e.printStackTrace();
25
} catch (IOException e) {
26
e.printStackTrace();
27
}
28
}
29
}
30
Copied!
Do not forget to create a folder called "images" inside /src/main/resources and save the images inside it [images].

Methods

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

References

Last modified 3yr ago