Exemplo TextAreaXlet

Esse exemplo exercita o uso das seguintes funcionalidades:

  • Ciclo de vida de Xlet pelo pacote javax.tv.xlet
  • Pintura na tela com Graphics do pacote com.sun.dtv.lwuit..
  • Widigt gráfico LWUIT: TextArea.
import java.awt.BorderLayout;

import javax.tv.xlet.Xlet;
import javax.tv.xlet.XletContext;
import javax.tv.xlet.XletStateChangeException;

import com.sun.dtv.lwuit.Form;
import com.sun.dtv.lwuit.TextArea;
import com.sun.dtv.lwuit.geom.Dimension;

public class TextAreaXlet extends Form implements Xlet {

    private XletContext context;

    public void initXlet(XletContext ctx) throws XletStateChangeException {
        this.context = ctx;
    }

    public void startXlet() throws XletStateChangeException {
        setTitle("Keyboard");
        this.setSize(new Dimension(400, 200));
        TextArea textArea = new TextArea();

        textArea.setConstraint(TextArea.URL); // ANY, EMAILADDR, NUMERIC,
                                                // PHONENUMBER, URL, DECIMAL,
                                                // PASSWORD

        addComponent(BorderLayout.CENTER, textArea);
        show();
    }

    public void pauseXlet() {
    }

    public void destroyXlet(boolean unconditional)
            throws XletStateChangeException {
        context.notifyDestroyed();
    }

}
<pre>