开发者

put vertical scrollbar in luwit form

how can we put vertical scroll bar in lwuit form. I have tried setScrollableY(true) method but it doesn't work.

My Code is here.

import com.sun.lwuit.*;
import com.sun.lwuit.events.ActionListener;

public class ChangePWD extends Form {

    private Label lblold,  lblnew1,  lblnew2;
    private TextField txtOldPwd,  txtNewpwd1,  txtNewpwd2;
    private Command cmdClose,  cmdSave;

    ChangePWD() {
        super("Change Password");
        setScrollableY(true);
        lblold = new Label("Enter Old Password");
        txtOldPwd = new TextField("");
        txtOldPwd.setConstraint(TextField.PASSWORD);

        lblnew1 = new Label("Enter New Password");
        txtNewpwd1 = new TextField("");
        txtNewpwd1.setConstraint(TextField.PASSWORD);

        lblnew2 = new Label("Confirm New Password");
        txtNewpwd2 = new TextField("");
        txtNewpwd2.setConstraint(TextField.PASSWORD);


        cmdClose = new Command("Close");
        cmdSave = new Command("Save");


        addCommand(cmdSave);
        addCommand(cmdClose);
        addComponent(lblold);
        addComponent(txtOldPwd);
        addComponent(lblnew1);
        addComponent(txtNewpwd1);
        addComponent(lblnew2);
        addComponent(txtNewpwd2);

    }

    public static ChangePWD createChangePWD(ActionListener l) {
        ChangePWD p = new ChangePWD();
        p.addCommandListener(l);
        return p;
    }

    public Command getSave() {
        return cmdSave;
    }

    public Command getClose() {
        return cmdClose;
    }

    public String getTxtOldpwd(){
        return t开发者_开发百科xtOldPwd.getText();
    }

    public String getTxtNewpwd1(){
        return txtNewpwd1.getText();
    }
    public String getTxtNewpwd2(){
        return txtNewpwd2.getText();
    }
}

If you have any idea then suggest me.

Thank You.


Add

setHeigth(1) ;

before

setScrollableY(true) ;

This worked for me. I still don't understand why actually.

Yannik

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜