J2ME LWUIT - 在滚动条上显示外部屏幕标签时出错
我正在使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最后我解决了。
我删除了第二个容器,将表单的布局更改为 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?
也许您必须“冻结”表单并使其不可滚动。使用
Form.setScrollable(false)
设置Form
不可滚动,并将BorderLayout
置于中心/北部Container
可滚动。尝试这样做。Maybe you must "freeze" the
Form
and make it not scrollable. Set theForm
not scrollable usingForm.setScrollable(false)
and make the center/northContainer
of yourBorderLayout
scrollable. Try to do that.