use of com.vaadin.v7.ui.Label in project CodenameOne by codenameone.
the class GoogleLoginSample method showContactsForm.
public void showContactsForm(UserData data) {
Form f = new Form("Contact Info");
f.setToolbar(new Toolbar());
f.getToolbar().setTitle("Contact Info");
Form prev = CN.getCurrentForm();
if (prev != null) {
f.getToolbar().setBackCommand(new Command("Back") {
public void actionPerformed(ActionEvent evt) {
prev.show();
}
});
}
f.add(new Label("You are logged in as " + fullName));
Button logout = new Button("Log out");
logout.addActionListener(e -> {
GoogleConnect.getInstance().doLogout();
Preferences.set(tokenPrefix + "tokenExpires", -1);
Preferences.set(tokenPrefix + "token", (String) null);
showLoginForm();
});
f.add(logout);
f.show();
}
use of com.vaadin.v7.ui.Label in project CodenameOne by codenameone.
the class GoogleMapsAddMarkerSample method start.
public void start() {
if (current != null) {
current.show();
return;
}
Coord location = new Coord(37.7831, -122.401558);
Form mapDemo = new Form("Maps", new BorderLayout());
if (BrowserComponent.isNativeBrowserSupported()) {
System.out.println("Browser Component Supported");
MapContainer mc = new MapContainer(JS_API_KEY);
// Add buttons at top to provide an offset so we can test event
// coordinates properly.
mapDemo.add(BorderLayout.NORTH, BoxLayout.encloseY(new Button("Button 1"), new Button("Button 2")));
mapDemo.add(BorderLayout.CENTER, BorderLayout.centerEastWest(mc, null, new Button("Button 5")));
Coord moscone = new Coord(37.7831, -122.401558);
mc.zoom(moscone, 5);
mc.setCameraPosition(moscone);
mc.addTapListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
// Point of the screen where the user pressed
int x = evt.getX();
int y = evt.getY();
// I get the coordinates from the point of the screen
Coord coord = mc.getCoordAtPosition(x, y);
// I create the marker, with a style
Style s = new Style();
s.setFgColor(0xff0000);
s.setBgTransparency(0);
FontImage markerImg = FontImage.createMaterial(FontImage.MATERIAL_PLACE, s);
EncodedImage icon = EncodedImage.createFromImage(markerImg, false);
mc.addMarker(icon, coord, "My position", null, null);
mc.zoom(coord, 15);
}
});
// mc.setShowMyLocation(true);
} else {
// iOS Screenshot process...
mapDemo.add(new Label("Loading, please wait...."));
}
mapDemo.show();
}
use of com.vaadin.v7.ui.Label in project CodenameOne by codenameone.
the class GradientTest method start.
public void start() {
if (current != null) {
current.show();
return;
}
Form hi = new Form("Hi World", BoxLayout.y());
hi.getContentPane().setUIID("Gradient");
hi.add(new Label("Hi World"));
hi.show();
}
use of com.vaadin.v7.ui.Label in project CodenameOne by codenameone.
the class AutocompleteSample2788 method start.
public void start() {
if (current != null) {
current.show();
return;
}
Form hi = new Form("Popup test", BorderLayout.absolute());
AutoCompleteTextField autocomplete = new AutoCompleteTextField("1", "2", "3", "11", "22", "33");
autocomplete.setMinimumLength(1);
Button tapMe = new Button("Tap me leaving the popup opened");
tapMe.addActionListener(l -> {
hi.replace(autocomplete, new Label("other content"), null);
hi.revalidate();
});
hi.add(BorderLayout.CENTER, autocomplete);
hi.add(BorderLayout.NORTH, tapMe);
hi.show();
}
use of com.vaadin.v7.ui.Label in project CodenameOne by codenameone.
the class BindButtonStateTest method start.
public void start() {
if (current != null) {
current.show();
return;
}
Form hi = new Form("Hi World", BoxLayout.y());
Button button1 = new Button("Button 1");
button1.setIconUIID("GrayIcon");
// button1.getIconStyleComponent().getStyle().setFgColor(0xff0000);
FontImage.setIcon(button1, FontImage.MATERIAL_INBOX, -1);
Button button2 = new Button("Button 2");
button2.bindStateTo(button1);
hi.add(new Label("Hi World"));
hi.addAll(button1, button2);
hi.show();
}
Aggregations