Scroll S40容器LWUIT中的自动滚动

Scroll S40容器LWUIT中的自动滚动,scroll,lwuit,autoscroll,Scroll,Lwuit,Autoscroll,这是我的密码。我希望第20个标签是可见的,任何人都知道如何实现它 另一篇帖子说componentOfLastContainer.requestFocus(); centerBigContainer.repaint(); 会管用的,但对我来说似乎不管用。我需要你的帮助,谢谢 public class TestView extends Form{ private TextArea inputText; private Container chatScreen = new Container(new

这是我的密码。我希望第20个标签是可见的,任何人都知道如何实现它

另一篇帖子说componentOfLastContainer.requestFocus(); centerBigContainer.repaint(); 会管用的,但对我来说似乎不管用。我需要你的帮助,谢谢

public class TestView extends Form{
private TextArea inputText;
private Container chatScreen = new Container(new BoxLayout(BoxLayout.Y_AXIS));

public TestView () {
    super("test", null);
    setupUI();
        }

void setupUI() {
    setLayout(new BorderLayout());
    setScrollable(false);
    chatScreen.setScrollableY(true);
    addComponent(BorderLayout.CENTER, chatScreen);
    inputText = new TextArea(2, this);
    inputText.setGrowByContent(true);
    inputText.setMaxSize(1000);
    Container sendContainer = new Container(new BorderLayout());
    sendContainer.addComponent(BorderLayout.CENTER, inputText);
    addComponent(BorderLayout.SOUTH, sendContainer);


    for (int i = 0; i < 20; i++) {
        Label l = new Label("sdjfksjfksjd" + i);
        c = new Container();
        c.addComponent(l );
        chatScreen.addComponent(c);
    }

  c.requestFocus();

  chatScreen.repaint();


    Display.getInstance().callSerially(new Runnable(){

            public void run() {
                  c.requestFocus();

                 chatScreen.repaint();
            }
        });


}
公共类TestView扩展表单{
私人文本区输入文本;
私有容器chatScreen=新容器(新的BoxLayout(BoxLayout.Y_轴));
公共测试视图(){
超级(“测试”,空);
setupUI();
}
void setupUI(){
setLayout(新的BorderLayout());
设置可滚动(假);
chatScreen.setScrollableY(真);
addComponent(BorderLayout.CENTER,聊天屏);
inputText=新的文本区域(2,此区域);
inputText.setGrowByContent(真);
inputText.setMaxSize(1000);
Container sendContainer=新容器(newborderlayout());
sendContainer.addComponent(BorderLayout.CENTER,inputText);
addComponent(BorderLayout.SOUTH,sendContainer);
对于(int i=0;i<20;i++){
标签l=新标签(“SDJFKSJD”+i);
c=新容器();
c、 添加组分(l);
chatScreen.addComponent(c);
}
c、 requestFocus();
chatScreen.repaint();
Display.getInstance().callSerially(new Runnable()){
公开募捐{
c、 requestFocus();
chatScreen.repaint();
}
});
}

我猜如果请求焦点不适用于您,那么它与您的文本区域有关。我对诺基亚fork没有太大帮助,但这应该可以解决问题。

非常感谢您的回复。我想实现一个类似于此布局的聊天页面,上面的消息和下面的输入文本区域。当新消息出现时,它会添加到最后你知道实现我的目标的其他方法吗?另一个问题,文本区域不能按内容增长,当按1行构建时。我想构建1行文本区域,然后随着用户输入的增加文本区域也会增长,你知道如何实现吗?再次感谢,这两个问题你应该回答d通常接受答案并创建一个新的。我建议你看看Lwit存储库中的聊天演示,在那里它显示了一个类似iPhone的泡泡聊天。文本区域可能会增长。它只是使布局方面的一些事情变得复杂,因为布局需要回流,而布局回流很难以性能的方式实现。好的,我接受。但是我的pr问题还没有解决。你能给我发封电子邮件吗?然后我可以给你看我的演示。也许你会找到解决方法。谢谢。我的电子邮件254035543@qq.com.我需要你的帮助,我已经实现了bublle风格的Meessage。在你的帮助下,我将实现一个实用的聊天应用程序。我已经看过你的皮条客聊天演示,这对我实现bubble很有帮助样式消息。但我还找不到解决我的两个问题的答案。1,聊天屏幕如何自动滚动?2,文本区域从1行增长。第一行更重要,因为它将给用户正常的聊天体验