J2ME LWUIT - 在滚动条上显示外部屏幕标签时出错

发布于 2024-12-28 17:38:33 字数 1773 浏览 1 评论 0原文

我正在使用 LWUIT 开发 J2ME 应用程序。 我需要显示 10 个值,每个值都有一个 Label

像这样的事情:

Label1       Value1
Label2       Value2
Label3       Value3
Label4       Value4
............
LabelN       ValueN

我为每个“行”使用 1 个 Container,为每个“行容器”使用一个大的 Container

我的问题是屏幕外的“行” 。当我使用滚动时,最后 4 对 Label+value 没有显示,

我不知道为什么。 有人可以解决这个问题吗?

这是我的代码:

this.setLayout(new BorderLayout());
PromotionMonitorDTO promotionMonitorDTO = Cloud.getPromotionMonitor();
Utils utils = new Utils();
Font f = Font.getBitmapFont("movSmall");
Container cellContainer = new Container(new BoxLayout(BoxLayout.Y_AXIS));
Container rowContainer = new Container(new BoxLayout(BoxLayout.X_AXIS));

//FIRST PAIR///////////////////////

String stringValue = utils.calendarToShorString(promotionMonitorDTO.getLastUpdate());
Label valor = new Label(LanguageManager.getText("LastUpdate"));
valor.getStyle().setFont(f);        
rowContainer.addComponent(valor);  
valor = new Label(LanguageManager.getText(stringValue));
valor.getStyle().setFont(f);
rowContainer.addComponent(valor);        
cellContainer.addComponent(rowContainer);
rowContainer = new Container(new BoxLayout(BoxLayout.X_AXIS));

//SECOND PAIR///////////////////////

stringValue = String.valueOf(promotionMonitorDTO.getInitialTarget());
valor = new Label(LanguageManager.getText("InitialTarget"));
valor.getStyle().setFont(f);        
rowContainer.addComponent(valor);  
valor = new Label(LanguageManager.getText(stringValue));
valor.getStyle().setFont(f);
rowContainer.addComponent(valor);   
cellContainer.addComponent(rowContainer);

////////8 MORE PAIRS////////////////////

this.addComponent(BorderLayout.NORTH, cellContainer);

I'm working on a J2ME application using LWUIT.
I need to show 10 values with a Label each one.

Something like this:

Label1       Value1
Label2       Value2
Label3       Value3
Label4       Value4
............
LabelN       ValueN

I'm using 1 Container for each "row" and one big Container for each "row container"

My problem is with the "rows" outside the screen. The last 4 pairs of Label+value are not showing when I use the scroll

I don't know why.
Can someone solve this?

This is my code:

this.setLayout(new BorderLayout());
PromotionMonitorDTO promotionMonitorDTO = Cloud.getPromotionMonitor();
Utils utils = new Utils();
Font f = Font.getBitmapFont("movSmall");
Container cellContainer = new Container(new BoxLayout(BoxLayout.Y_AXIS));
Container rowContainer = new Container(new BoxLayout(BoxLayout.X_AXIS));

//FIRST PAIR///////////////////////

String stringValue = utils.calendarToShorString(promotionMonitorDTO.getLastUpdate());
Label valor = new Label(LanguageManager.getText("LastUpdate"));
valor.getStyle().setFont(f);        
rowContainer.addComponent(valor);  
valor = new Label(LanguageManager.getText(stringValue));
valor.getStyle().setFont(f);
rowContainer.addComponent(valor);        
cellContainer.addComponent(rowContainer);
rowContainer = new Container(new BoxLayout(BoxLayout.X_AXIS));

//SECOND PAIR///////////////////////

stringValue = String.valueOf(promotionMonitorDTO.getInitialTarget());
valor = new Label(LanguageManager.getText("InitialTarget"));
valor.getStyle().setFont(f);        
rowContainer.addComponent(valor);  
valor = new Label(LanguageManager.getText(stringValue));
valor.getStyle().setFont(f);
rowContainer.addComponent(valor);   
cellContainer.addComponent(rowContainer);

////////8 MORE PAIRS////////////////////

this.addComponent(BorderLayout.NORTH, cellContainer);

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

时光瘦了 2025-01-04 17:38:33

最后我解决了。

我删除了第二个容器,将表单的布局更改为 BoxLayout(BoxLayout.Y_AXIS) 并将所有“行容器”添加到表单中,

通过这些更改,我具有相同的图形功能并且滚动正在工作。

我必须删除这个问题吗? o 留给别人吗?

Finally I solved.

I removed the second Container, I changed the Layout of the form to BoxLayout(BoxLayout.Y_AXIS) and I added all the "row containers" to the form,

With those changes, I have the same Graphic funcionality and the scroll is working.

I have to remove the question? o leave it for others?

冧九 2025-01-04 17:38:33

也许您必须“冻结”表单并使其不可滚动。使用 Form.setScrollable(false) 设置 Form 不可滚动,并将 BorderLayout 置于中心/北部 Container可滚动。尝试这样做。

Maybe you must "freeze" the Form and make it not scrollable. Set the Form not scrollable using Form.setScrollable(false) and make the center/north Container of your BorderLayoutscrollable. Try to do that.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文