Search in sources :

Example 26 with Form

use of com.codename1.ui.Form 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 27 with Form

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

the class IOSImplementation method paintNow.

public static void paintNow() {
    final Display d = Display.getInstance();
    d.callSeriallyAndWait(new Runnable() {

        @Override
        public void run() {
            Form f = d.getCurrent();
            f.paintComponent(instance.getCodenameOneGraphics(), true);
        }
    }, 50);
}
Also used : Form(com.codename1.ui.Form) Display(com.codename1.ui.Display)

Example 28 with Form

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

the class Ads method animate.

/**
 * {@inheritDoc}
 */
public boolean animate() {
    Form parent = getComponentForm();
    if (parent == null || !parent.isVisible()) {
        return false;
    }
    long t = System.currentTimeMillis();
    if (t - elapsed > getUpdateDuration() * 1000) {
        // we need to update the ad
        elapsed = t;
        requestAd();
    }
    return super.animate();
}
Also used : Form(com.codename1.ui.Form)

Example 29 with Form

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

the class FloatingActionButton method fireActionEvent.

@Override
protected void fireActionEvent(int x, int y) {
    Form current = Display.getInstance().getCurrent();
    if (current instanceof Dialog) {
        ((Dialog) current).dispose();
    }
    super.fireActionEvent(x, y);
}
Also used : Form(com.codename1.ui.Form) Dialog(com.codename1.ui.Dialog)

Example 30 with Form

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

the class ImageViewer method setImage.

/**
 * Sets the currently showing image
 * @param image the image to set
 */
public void setImage(Image image) {
    if (this.image != image) {
        panPositionX = 0.5f;
        panPositionY = 0.5f;
        zoom = MIN_ZOOM;
        this.image = image;
        updatePositions();
        repaint();
        if (image.isAnimation()) {
            Form f = getComponentForm();
            if (f != null) {
                f.registerAnimated(this);
            }
        }
    }
}
Also used : Form(com.codename1.ui.Form)

Aggregations

Form (com.codename1.ui.Form)90 ActionEvent (com.codename1.ui.events.ActionEvent)41 Component (com.codename1.ui.Component)38 BorderLayout (com.codename1.ui.layouts.BorderLayout)38 Container (com.codename1.ui.Container)26 ActionListener (com.codename1.ui.events.ActionListener)25 Dialog (com.codename1.ui.Dialog)21 Command (com.codename1.ui.Command)19 Hashtable (java.util.Hashtable)17 Label (com.codename1.ui.Label)14 Style (com.codename1.ui.plaf.Style)14 IOException (java.io.IOException)14 TextArea (com.codename1.ui.TextArea)13 Vector (java.util.Vector)12 Button (com.codename1.ui.Button)11 Graphics (com.codename1.ui.Graphics)9 RadioButton (com.codename1.ui.RadioButton)9 Animation (com.codename1.ui.animations.Animation)9 Image (com.codename1.ui.Image)8 UIManager (com.codename1.ui.plaf.UIManager)8