Search in sources :

Example 96 with Label

use of com.codename1.rad.models.Property.Label in project CodenameOne by codenameone.

the class SMSShare method createRendererMultiButton.

private MultiButton createRendererMultiButton() {
    MultiButton b = new MultiButton();
    b.setIconName("icon");
    b.setNameLine1("fname");
    b.setNameLine2("phone");
    b.setUIID("Label");
    return b;
}
Also used : MultiButton(com.codename1.components.MultiButton)

Example 97 with Label

use of com.codename1.rad.models.Property.Label in project CodenameOne by codenameone.

the class Lifecycle method runApp.

/**
 * This method is invoked by start to show the first form of the application
 */
public void runApp() {
    Form hello = new Form("Hello", BoxLayout.y());
    hello.add(new Label("You should override runApp() with your code"));
    hello.show();
}
Also used : Form(com.codename1.ui.Form) CN.getCurrentForm(com.codename1.ui.CN.getCurrentForm) Label(com.codename1.ui.Label)

Example 98 with Label

use of com.codename1.rad.models.Property.Label in project CodenameOne by codenameone.

the class TestUtils method assertLabel.

/**
 * Asserts that we have a label with the given text baring the given name
 * @param path the path of the label
 * @param text the text of the label
 */
public static void assertLabel(int[] path, String text) {
    if (verbose) {
        log("assertLabel(" + toString(path) + ", " + text + ")");
    }
    Label l = (Label) getComponentByPath(path);
    assertBool(l != null, "Null label" + text);
    assertBool(text == l.getText() || text.equals(l.getText()), ("" + l.getText()) + " != " + text);
}
Also used : Label(com.codename1.ui.Label)

Example 99 with Label

use of com.codename1.rad.models.Property.Label in project CodenameOne by codenameone.

the class TestUtils method findLabelText.

/**
 * Finds a component with the given name, works even with UI's that weren't created with the GUI builder
 * @param text the text of the label/button
 * @return the component with the given label text within the tree
 */
private static Label findLabelText(Container root, String text) {
    if (verbose) {
        log("findLabelText(" + root + ", " + text + ")");
    }
    int count = root.getComponentCount();
    for (int iter = 0; iter < count; iter++) {
        Component c = root.getComponentAt(iter);
        if (c instanceof Label) {
            String n = ((Label) c).getText();
            if (n != null && n.equals(text)) {
                return (Label) c;
            }
            // will work for cases of upcase due to Android theme upcasing of buttons
            n = (String) c.getClientProperty("cn1$origText");
            if (n != null && n.equals(text)) {
                return (Label) c;
            }
            continue;
        }
        if (c instanceof Container) {
            Label l = findLabelText((Container) c, text);
            if (l != null) {
                return l;
            }
        }
    }
    return null;
}
Also used : Container(com.codename1.ui.Container) Label(com.codename1.ui.Label) Component(com.codename1.ui.Component)

Example 100 with Label

use of com.codename1.rad.models.Property.Label in project CodenameOne by codenameone.

the class TestUtils method assertTextArea.

/**
 * Asserts that we have a label with the given text baring the given name
 * @param path the path to the text area
 * @param text the text of the label
 */
public static void assertTextArea(int[] path, String text) {
    if (verbose) {
        log("assertTextArea(" + toString(path) + ", " + text + ")");
    }
    TextArea l = (TextArea) getComponentByPath(path);
    assertBool(l != null, "Null area " + text);
    assertBool(l.getText().equals(text), "assertTextArea: " + l.getText() + " != " + text);
}
Also used : TextArea(com.codename1.ui.TextArea)

Aggregations

Label (com.codename1.ui.Label)129 Form (com.codename1.ui.Form)95 Button (com.codename1.ui.Button)50 BorderLayout (com.codename1.ui.layouts.BorderLayout)50 Container (com.codename1.ui.Container)49 Component (com.codename1.ui.Component)27 SpanLabel (com.codename1.components.SpanLabel)26 Style (com.codename1.ui.plaf.Style)24 BoxLayout (com.codename1.ui.layouts.BoxLayout)19 TextArea (com.codename1.ui.TextArea)18 ActionEvent (com.codename1.ui.events.ActionEvent)18 IOException (java.io.IOException)18 Image (com.codename1.ui.Image)17 Dimension (com.codename1.ui.geom.Dimension)16 TextField (com.codename1.ui.TextField)15 ActionListener (com.codename1.ui.events.ActionListener)15 LayeredLayout (com.codename1.ui.layouts.LayeredLayout)15 Toolbar (com.codename1.ui.Toolbar)13 FlowLayout (com.codename1.ui.layouts.FlowLayout)12 EncodedImage (com.codename1.ui.EncodedImage)11