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;
}
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);
}
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();
}
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);
}
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);
}
}
}
}
Aggregations