Search in sources :

Example 61 with Component

use of com.codename1.ui.Component in project CodenameOne by codenameone.

the class BlackBerryImplementation method editString.

public void editString(final Component cmp, final int maxSize, final int constraint, final String text, int keyCode) {
    TextArea txtCmp = (TextArea) cmp;
    String edit = (String) txtCmp.getClientProperty("RIM.nativePopup");
    if (edit != null) {
        EditPopup editpop = new EditPopup(txtCmp, maxSize);
        editpop.startEdit();
    } else {
        nativeEdit(txtCmp, txtCmp.getMaxSize(), txtCmp.getConstraint(), txtCmp.getText(), keyCode);
    }
}
Also used : TextArea(com.codename1.ui.TextArea)

Example 62 with Component

use of com.codename1.ui.Component in project CodenameOne by codenameone.

the class AndroidKeyboard method showKeyboard.

public void showKeyboard(boolean show) {
    // manager.restartInput(myView);
    // if (keyboardShowing != show) {
    // manager.toggleSoftInputFromWindow(myView.getWindowToken(), 0, 0);
    // this.keyboardShowing = show;
    // }
    System.out.println("showKeyboard " + show);
    Form current = Display.getInstance().getCurrent();
    if (current != null) {
        Component cmp = current.getFocused();
        if (cmp != null && cmp instanceof TextArea) {
            TextArea txt = (TextArea) cmp;
            if (show) {
                Display.getInstance().editString(txt, txt.getMaxSize(), txt.getConstraint(), txt.getText(), 0);
            }
        }
    } else {
        InPlaceEditView.endEdit();
    }
// if(!show){
// impl.saveTextEditingState();
// }
}
Also used : Form(com.codename1.ui.Form) TextArea(com.codename1.ui.TextArea) Component(com.codename1.ui.Component)

Example 63 with Component

use of com.codename1.ui.Component in project CodenameOne by codenameone.

the class BlackBerryCanvas method paint.

public void paint(Graphics g) {
    int f = getFieldCount();
    if (f > 0) {
        g.drawBitmap(0, 0, getWidth(), getHeight(), screen, 0, 0);
        Form currentForm = Display.getInstance().getCurrent();
        for (int iter = 0; iter < f; iter++) {
            Field fld = getField(iter);
            int pops = 0;
            if (currentForm != null) {
                PeerComponent p = findPeer(currentForm.getContentPane(), fld);
                if (p != null) {
                    pops = clipOnLWUITBounds(p, g);
                } else {
                    Component cmp = currentForm.getFocused();
                    // we are now editing an edit field
                    if (cmp != null && cmp instanceof TextArea && cmp.hasFocus() && fld instanceof EditField) {
                        pops = clipOnLWUITBounds(cmp, g);
                        int x = fld.getLeft();
                        int y = fld.getTop();
                        g.clear(x, y, Math.max(cmp.getWidth(), fld.getWidth()), Math.max(cmp.getHeight(), fld.getHeight()));
                    }
                }
            }
            paintChild(g, fld);
            while (pops > 0) {
                g.popContext();
                pops--;
            }
        }
    } else {
        g.drawBitmap(0, 0, getWidth(), getHeight(), screen, 0, 0);
    }
    g.setColor(0);
    g.drawText(debug, 0, 0);
    painted = true;
}
Also used : EditField(net.rim.device.api.ui.component.EditField) Field(net.rim.device.api.ui.Field) PeerComponent(com.codename1.ui.PeerComponent) EditField(net.rim.device.api.ui.component.EditField) Form(com.codename1.ui.Form) TextArea(com.codename1.ui.TextArea) Component(com.codename1.ui.Component) PeerComponent(com.codename1.ui.PeerComponent)

Example 64 with Component

use of com.codename1.ui.Component in project CodenameOne by codenameone.

the class BooleanContainer method editNextTextArea.

/**
 * Opens onscreenkeyboard for the next textfield. The method works in EDT if
 * needed.
 */
public static void editNextTextArea() {
    Runnable task = new Runnable() {

        public void run() {
            Component next = getNextEditComponent();
            if (next != null) {
                if (next instanceof TextArea) {
                    TextArea text = (TextArea) next;
                    text.requestFocus();
                    Display.getInstance().editString(next, text.getMaxSize(), text.getConstraint(), text.getText(), 0);
                }
            } else {
                IOSImplementation.foldKeyboard();
            }
        }
    };
    Display.getInstance().callSerially(task);
}
Also used : TextArea(com.codename1.ui.TextArea) Component(com.codename1.ui.Component)

Example 65 with Component

use of com.codename1.ui.Component in project CodenameOne by codenameone.

the class Ads method launchAd.

private void launchAd() {
    Component c = getComponentAt(0);
    if (c instanceof HTMLComponent) {
        HTMLComponent h = (HTMLComponent) c;
        h.setSupressExceptions(true);
        HTMLElement dom = h.getDOM();
        Vector links = dom.getDescendantsByTagName("a");
        if (links.size() > 0) {
            HTMLElement e = (HTMLElement) links.elementAt(0);
            String link = e.getAttribute("href");
            if (link != null) {
                Display.getInstance().execute(link);
            }
        }
    }
}
Also used : HTMLElement(com.codename1.ui.html.HTMLElement) HTMLComponent(com.codename1.ui.html.HTMLComponent) Component(com.codename1.ui.Component) Vector(java.util.Vector) HTMLComponent(com.codename1.ui.html.HTMLComponent)

Aggregations

Component (com.codename1.ui.Component)152 Style (com.codename1.ui.plaf.Style)61 Container (com.codename1.ui.Container)55 Form (com.codename1.ui.Form)41 BorderLayout (com.codename1.ui.layouts.BorderLayout)40 TextArea (com.codename1.ui.TextArea)31 ActionEvent (com.codename1.ui.events.ActionEvent)28 Dimension (com.codename1.ui.geom.Dimension)28 Label (com.codename1.ui.Label)25 Point (com.codename1.ui.geom.Point)22 ArrayList (java.util.ArrayList)22 Rectangle (com.codename1.ui.geom.Rectangle)21 Vector (java.util.Vector)18 Button (com.codename1.ui.Button)16 Dialog (com.codename1.ui.Dialog)16 Hashtable (java.util.Hashtable)16 Image (com.codename1.ui.Image)15 TextField (com.codename1.ui.TextField)15 ActionListener (com.codename1.ui.events.ActionListener)13 BoxLayout (com.codename1.ui.layouts.BoxLayout)13