use of com.codename1.rad.models.Property.Label in project CodenameOne by codenameone.
the class GenericListCellRenderer method setComponentValueWithTickering.
private void setComponentValueWithTickering(Component cmp, Object value, Component l, Component rootRenderer) {
setComponentValue(cmp, value, l, rootRenderer);
if (cmp instanceof Label) {
if (selectionListener) {
if (l instanceof List) {
((List) l).addActionListener(mon);
}
parentList = l;
}
Label label = (Label) cmp;
if (label.shouldTickerStart() && Display.getInstance().shouldRenderSelection()) {
if (!label.isTickerRunning()) {
parentList = l;
if (parentList != null) {
Form f = parentList.getComponentForm();
if (f != null) {
f.registerAnimated(mon);
label.startTicker(cmp.getUIManager().getLookAndFeel().getTickerSpeed(), true);
}
}
}
} else {
if (label.isTickerRunning()) {
label.stopTicker();
}
label.setTextPosition(0);
}
}
}
use of com.codename1.rad.models.Property.Label in project CodenameOne by codenameone.
the class ImageViewerTest2679 method start.
public void start() {
if (current != null) {
current.show();
return;
}
Form f = new Form(new LayeredLayout());
f.setScrollableY(false);
f.setScrollableX(false);
f.getContentPane().setScrollableY(false);
f.getContentPane().setScrollableX(false);
ImageViewer viewer = new ImageViewer();
viewer.setAllowScaleDown(true);
viewer.setImageInitialPosition(ImageViewer.IMAGE_FILL);
ListModel images = new DefaultListModel();
final int w = 724;
final int h = 1024;
for (int i = 0; i < 10; i++) {
Image placeholder = Image.createImage(w, h);
Image img = URLImage.createCachedImage("experimentImage", "https://media.istockphoto.com/vectors/decorative-black-rectangular-frame-for-label-certificate-card-a3-a4-vector-id1039615844", placeholder, URLImage.FLAG_RESIZE_SCALE);
images.addItem(img);
}
f.addComponent(viewer);
viewer.setImageList(images);
f.show();
}
use of com.codename1.rad.models.Property.Label in project CodenameOne by codenameone.
the class InfiniteContainerSafeAreaTest method start.
public void start() {
if (current != null) {
current.show();
return;
}
Form hi = new Form("InfiniteContainer", new BorderLayout());
Style s = UIManager.getInstance().getComponentStyle("MultiLine1");
FontImage p = FontImage.createMaterial(FontImage.MATERIAL_PORTRAIT, s);
EncodedImage placeholder = EncodedImage.createFromImage(p.scaled(p.getWidth() * 3, p.getHeight() * 3), false);
InfiniteContainer ic = new InfiniteContainer() {
@Override
public Component[] fetchComponents(int index, int amount) {
java.util.List<Map<String, Object>> data = fetchPropertyData("Leeds");
MultiButton[] cmps = new MultiButton[data.size()];
for (int iter = 0; iter < cmps.length; iter++) {
Map<String, Object> currentListing = data.get(iter);
if (currentListing == null) {
return null;
}
String thumb_url = (String) currentListing.get("thumb_url");
String guid = (String) currentListing.get("guid");
String summary = (String) currentListing.get("summary");
cmps[iter] = new MultiButton(summary);
// cmps[iter].setIcon(URLImage.createToStorage(placeholder, guid, thumb_url));
}
return cmps;
}
};
ic.setUIID("Blue");
ic.setSafeArea(true);
ic.addComponent(new Label("This is a test"));
hi.add(BorderLayout.CENTER, ic);
hi.show();
}
use of com.codename1.rad.models.Property.Label in project CodenameOne by codenameone.
the class LandscapeToolbarHiddenSample method start.
public void start() {
if (current != null) {
current.show();
return;
}
Form hi = new Form("Test 2387", BoxLayout.y());
hi.add(new Label("Hi World"));
if (!CN.isPortrait()) {
hi.getToolbar().hideToolbar();
}
Button hide = new Button("Hide");
Button show = new Button("Show");
hide.addActionListener(e -> hi.getToolbar().hideToolbar());
show.addActionListener(e -> hi.getToolbar().showToolbar());
hi.addOrientationListener(e -> {
if (CN.isPortrait()) {
hi.getToolbar().showToolbar();
} else {
hi.getToolbar().hideToolbar();
}
});
hi.addAll(hide, show);
hi.show();
}
use of com.codename1.rad.models.Property.Label in project CodenameOne by codenameone.
the class SearchCommandTextHintSample2953 method start.
public void start() {
if (current != null) {
current.show();
return;
}
Form hi18 = new Form("FormTitle");
hi18.setLayout(BoxLayout.y());
Container cont18 = hi18.getContentPane();
hi18.getToolbar().addSearchCommand((e) -> {
String text = (String) e.getSource();
for (Component c : hi18.getContentPane()) {
c.setHidden(c instanceof Label && ((Label) c).getText().indexOf(text) < 0);
}
hi18.getComponentForm().animateLayout(150);
});
for (int i = 0; i < 20; i++) {
Label l = new Label("Label " + i);
cont18.add(l);
}
hi18.show();
}
Aggregations