use of com.codename1.rad.models.Property.Label in project CodenameOne by codenameone.
the class SideMenuTest3086 method start.
public void start() {
if (current != null) {
current.show();
return;
}
Toolbar.setGlobalToolbar(true);
Toolbar.setOnTopSideMenu(false);
Form hi2 = new Form("Hi2 World", BoxLayout.y());
hi2.add(new Label("Press to show form2"));
hi2.add(new Button(new Command("show form2") {
@Override
public void actionPerformed(ActionEvent evt) {
try {
Form hi = new Form("form2");
Toolbar tb = hi.getToolbar();
Image icon = theme.getImage("icon.png");
Container topBar = BorderLayout.east(new Label(icon));
topBar.add(BorderLayout.SOUTH, new Label("Cool App Tagline...", "SidemenuTagline"));
topBar.setUIID("SideCommand");
tb.addComponentToSideMenu(topBar);
tb.addMaterialCommandToSideMenu("Home", FontImage.MATERIAL_HOME, e -> {
});
hi.addComponent(new Label("form2 with sidemenu"));
// hi.forceRevalidate();
hi.show();
} catch (Exception ex) {
Dialog.show("Error", ex.getMessage(), "OK", null);
ex.printStackTrace();
}
}
}));
hi2.show();
}
use of com.codename1.rad.models.Property.Label in project CodenameOne by codenameone.
the class SocketSample method start.
public void start() {
if (current != null) {
current.show();
return;
}
Form hi = new Form("Socket Sample", BoxLayout.y());
Button server = new Button("Server Sockets");
Button client = new Button("Client Socket");
server.addActionListener(evt -> {
new ServerForm().show();
});
client.addActionListener(evt -> {
new ClientForm().show();
});
hi.add(new Label("Select mode")).add(server).add(client);
hi.show();
}
use of com.codename1.rad.models.Property.Label in project CodenameOne by codenameone.
the class SpanLabelIconAlignmentTest method start.
public void start() {
if (current != null) {
current.show();
return;
}
Form hi = new Form("Hi World", BoxLayout.y());
FontImage icon = FontImage.createMaterial(FontImage.MATERIAL_FIBER_MANUAL_RECORD, new Label().getStyle(), 30);
for (String str : text) {
SpanLabel l = new SpanLabel(str);
$("*", l).selectAllStyles().setFont(Font.createTrueTypeFont(Font.NATIVE_MAIN_REGULAR).derive(Display.getInstance().convertToPixels(4), Font.STYLE_PLAIN));
l.setIcon(icon);
hi.add(l);
}
for (String str : text) {
SpanButton l = new SpanButton(str);
l.setIcon(icon);
hi.add(l);
}
icon = FontImage.createMaterial(FontImage.MATERIAL_FIBER_MANUAL_RECORD, new Label().getStyle(), 4);
for (String str : text) {
SpanLabel l = new SpanLabel(str);
$("*", l).selectAllStyles().setFont(Font.createTrueTypeFont(Font.NATIVE_MAIN_REGULAR).derive(Display.getInstance().convertToPixels(4), Font.STYLE_PLAIN));
l.setIcon(icon);
hi.add(l);
}
for (String str : text) {
SpanLabel l = new SpanLabel();
// set text after the fact to test different flow
l.setText(str);
$("*", l).selectAllStyles().setFont(Font.createTrueTypeFont(Font.NATIVE_MAIN_REGULAR).derive(Display.getInstance().convertToPixels(4), Font.STYLE_PLAIN));
l.setIcon(icon);
hi.add(l);
}
hi.add(new Label("Hi World"));
hi.show();
}
use of com.codename1.rad.models.Property.Label in project CodenameOne by codenameone.
the class LinearGradientSample method start.
public void start() {
if (current != null) {
current.show();
return;
}
Form hi = new Form("Hi World", new BorderLayout());
Picker picker = new Picker();
picker.setStrings("No cycle", "Repeat", "Reflect");
picker.addActionListener(e -> {
if ("No cycle".equals(picker.getValue())) {
cycleMethod = NO_CYCLE;
} else if ("Repeat".equals(picker.getValue())) {
cycleMethod = REPEAT;
} else if ("Reflect".equals(picker.getValue())) {
cycleMethod = REFLECT;
}
hi.repaint();
});
hi.add(BorderLayout.NORTH, BoxLayout.encloseY(new SpanLabel("Drag pointer below to generate gradients"), new Label("Gradient Cycle Type:"), picker));
hi.add(BorderLayout.CENTER, new MyComponent());
hi.show();
}
use of com.codename1.rad.models.Property.Label in project CodenameOne by codenameone.
the class LoadingTextAnimationSample method showLabelTest.
private void showLabelTest() {
Form f = new Form("Hello", BoxLayout.y());
Label l = new Label("placeholder");
f.add(l);
LoadingTextAnimation.markComponentLoading(l);
f.show();
Timer t = new Timer();
t.schedule(new TimerTask() {
public void run() {
CN.callSerially(() -> {
LoadingTextAnimation.markComponentReady(l);
});
}
}, 2000);
}
Aggregations