Search in sources :

Example 51 with Label

use of com.vaadin.v7.ui.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);
}
Also used : Timer(java.util.Timer) TimerTask(java.util.TimerTask) Form(com.codename1.ui.Form) SpanLabel(com.codename1.components.SpanLabel) Label(com.codename1.ui.Label)

Example 52 with Label

use of com.vaadin.v7.ui.Label in project CodenameOne by codenameone.

the class MySample method start.

public void start() {
    if (current != null) {
        current.show();
        return;
    }
    Form hi = new Form("Hi World", BoxLayout.y());
    hi.add(new Label("Hi World"));
    hi.show();
}
Also used : Form(com.codename1.ui.Form) Label(com.codename1.ui.Label)

Example 53 with Label

use of com.vaadin.v7.ui.Label in project CodenameOne by codenameone.

the class NativeControlsSample method start.

public void start() {
    if (current != null) {
        current.show();
        return;
    }
    if (false) {
        webviewLoginTest();
        return;
    }
    Form hi = new Form("Hi World", BoxLayout.y());
    hi.add(new Label("Hi World"));
    Label result = new Label();
    NSelect<String> select = new NSelect<>();
    $(select).selectAllStyles().setFont(Font.createTrueTypeFont(Font.NATIVE_MAIN_LIGHT, 4f)).setFgColor(0xff0000).setBgColor(0x00ff00);
    select.setOptions("Red", "Green", "Blue", "Orange");
    select.addSelectionListener((i1, i2) -> {
        result.setText(select.getOption(select.getSelectedIndex()));
        hi.revalidateWithAnimationSafety();
    });
    hi.add(result);
    hi.add(select);
    hi.add("Text fields");
    hi.add("Username:");
    NTextField tf1 = new NTextField(TextField.USERNAME);
    System.out.println("Setting font to main light 15mm");
    tf1.getAllStyles().setFont(Font.createTrueTypeFont(Font.NATIVE_MAIN_LIGHT, 15f));
    System.out.println("Finished setting font");
    tf1.getAllStyles().setFgColor(0x003300);
    tf1.getAllStyles().setBgTransparency(255);
    tf1.getAllStyles().setBgColor(0xcccccc);
    tf1.getAllStyles().setAlignment(CENTER);
    hi.add(tf1);
    hi.add("Password:");
    NTextField tf2 = new NTextField(TextField.PASSWORD);
    hi.add(tf2);
    hi.add("Email:");
    NTextField emailField = new NTextField(TextField.EMAILADDR);
    hi.add(emailField);
    tf1.addActionListener(e -> {
    // tf2.setText(tf1.getText());
    });
    tf1.addChangeListener(e -> {
        result.setText(tf1.getText());
        hi.revalidateWithAnimationSafety();
    });
    tf2.addActionListener(e -> {
        Log.p("Action listener fired on password field");
        result.setText(tf2.getText());
        hi.revalidateWithAnimationSafety();
    });
    tf2.addDoneListener(e -> {
        Log.p("Done was clicked!!!");
    });
    hi.add(new TextField("LW field 1"));
    hi.add(new TextField("LW field 2"));
    hi.add(new TextField("LW field 3"));
    Button submit = new Button("Login");
    submit.addActionListener(e -> {
        Form f = new Form("Logged In", BoxLayout.y());
        Toolbar tb = new Toolbar();
        f.setToolbar(tb);
        tb.setBackCommand(new Command("") {

            @Override
            public void actionPerformed(ActionEvent e) {
                hi.showBack();
            }
        });
        f.add("Logged In!!!");
        f.show();
    });
    hi.add(submit);
    hi.show();
}
Also used : NSelect(com.codename1.nui.NSelect) Form(com.codename1.ui.Form) Button(com.codename1.ui.Button) Command(com.codename1.ui.Command) ActionEvent(com.codename1.ui.events.ActionEvent) Label(com.codename1.ui.Label) TextField(com.codename1.ui.TextField) NTextField(com.codename1.nui.NTextField) NTextField(com.codename1.nui.NTextField) Toolbar(com.codename1.ui.Toolbar)

Example 54 with Label

use of com.vaadin.v7.ui.Label in project CodenameOne by codenameone.

the class ProgressAnimationsSample method start.

public void start() {
    if (current != null) {
        current.show();
        return;
    }
    Form hi = new Form("Hi World", BoxLayout.y());
    hi.add(new Label("Hi World"));
    hi.add(new CommonProgressAnimations.CircleProgress());
    hi.add(new CommonProgressAnimations.LoadingTextAnimation());
    Label labelThatIsLoading = new Label("Loading...");
    hi.add(labelThatIsLoading);
    CommonProgressAnimations.CircleProgress.markComponentLoading(labelThatIsLoading);
    UITimer.timer(2000, false, hi, () -> {
        labelThatIsLoading.setText("Found 248 results");
        CommonProgressAnimations.CircleProgress.markComponentReady(labelThatIsLoading);
    });
    Label anotherLabelThatIsLoading = new Label("Loading...");
    hi.add(anotherLabelThatIsLoading);
    CommonProgressAnimations.CircleProgress.markComponentLoading(anotherLabelThatIsLoading);
    UITimer.timer(4000, false, hi, () -> {
        labelThatIsLoading.setText("Found 512 results");
        CommonProgressAnimations.CircleProgress.markComponentReady(anotherLabelThatIsLoading, CommonTransitions.createFade(300));
    });
    TextArea someText = new TextArea("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.");
    someText.setGrowByContent(true);
    someText.setRows(4);
    someText.setColumns(40);
    someText.setPreferredW(Display.getInstance().getDisplayWidth());
    hi.add(someText);
    CommonProgressAnimations.LoadingTextAnimation.markComponentLoading(someText).cols(40).rows(5);
    UITimer.timer(6000, false, hi, () -> {
        CommonProgressAnimations.CircleProgress.markComponentReady(someText, CommonTransitions.createFade(300));
    });
    hi.show();
}
Also used : Form(com.codename1.ui.Form) TextArea(com.codename1.ui.TextArea) SpanLabel(com.codename1.components.SpanLabel) Label(com.codename1.ui.Label) CommonProgressAnimations(com.codename1.ui.CommonProgressAnimations)

Example 55 with Label

use of com.vaadin.v7.ui.Label in project CodenameOne by codenameone.

the class RTLLayoutAndPadding method start.

public void start() {
    if (current != null) {
        current.show();
        return;
    }
    Form hi = new Form("Hi World", BoxLayout.y());
    Label l = new Label("Hi World");
    FlowLayout fl = new FlowLayout();
    fl.setAlign(CENTER);
    Container row = new Container(fl);
    row.add(new Label("Center"));
    $(row).selectAllStyles().setPaddingMillimeters(3f).setBgColor(0x003366).setBorder(RoundBorder.create());
    hi.add(row);
    fl = new FlowLayout();
    fl.setAlign(RIGHT);
    row = new Container(fl);
    row.add(new Label("Right"));
    $(row).selectAllStyles().setPaddingMillimeters(3f).setBgColor(0x003366).setBorder(RoundBorder.create());
    hi.add(row);
    fl = new FlowLayout();
    fl.setAlign(LEFT);
    row = new Container(fl);
    row.add(new Label("Left"));
    $(row).selectAllStyles().setPaddingMillimeters(3f).setBgColor(0x003366).setBorder(RoundBorder.create());
    hi.add(row);
    fl = new FlowLayout();
    fl.setAlign(CENTER);
    row = new Container(fl);
    row.add(new Label("Center"));
    $(row).selectAllStyles().setPaddingMillimeters(1f, 2f, 1f, 5f).setBgColor(0x003366).setBorder(RoundBorder.create());
    hi.add(row);
    AutoCompleteTextField tf = new AutoCompleteTextField("Red", "Green", "Blue");
    hi.add(FlowLayout.encloseIn(tf));
    hi.show();
}
Also used : Container(com.codename1.ui.Container) AutoCompleteTextField(com.codename1.ui.AutoCompleteTextField) FlowLayout(com.codename1.ui.layouts.FlowLayout) Form(com.codename1.ui.Form) Label(com.codename1.ui.Label)

Aggregations

Label (com.codename1.ui.Label)129 Form (com.codename1.ui.Form)85 Label (com.vaadin.ui.Label)56 Container (com.codename1.ui.Container)45 Button (com.codename1.ui.Button)41 Label (com.vaadin.v7.ui.Label)40 TextField (com.vaadin.v7.ui.TextField)32 BorderLayout (com.codename1.ui.layouts.BorderLayout)31 Button (com.vaadin.ui.Button)31 ComboBox (com.vaadin.v7.ui.ComboBox)31 I18nProperties (de.symeda.sormas.api.i18n.I18nProperties)31 Captions (de.symeda.sormas.api.i18n.Captions)29 Strings (de.symeda.sormas.api.i18n.Strings)28 VerticalLayout (com.vaadin.ui.VerticalLayout)26 FacadeProvider (de.symeda.sormas.api.FacadeProvider)26 HorizontalLayout (com.vaadin.ui.HorizontalLayout)24 Window (com.vaadin.ui.Window)24 CssStyles (de.symeda.sormas.ui.utils.CssStyles)24 ValoTheme (com.vaadin.ui.themes.ValoTheme)21 List (java.util.List)21