2012-01-23 45 views
2

我正在使用LWUIT開發J2ME應用程序。 我需要顯示10個值,每個值爲LabelJ2ME LWUIT - 滾動時顯示外部屏幕標籤的錯誤

事情是這樣的:

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

我使用1 Container每個「行」和一個大Container每個「行容器」

我的問題是與「行」之外屏幕。當我使用滾動時,最後4對Label +值不顯示

我不知道爲什麼。 有人可以解決這個問題嗎?

這是我的代碼:

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); 

回答

2

最後我解決了。

我去除第二容器,我改變了形式的佈局BoxLayout(BoxLayout.Y_AXIS)和我加入所有的「行容器」的形式,

這些變化,我具有相同的圖形的funcionality和滾動是加工。

我必須刪除問題嗎? o把它留給別人?

+0

不要刪除,您必須接受您的回答 – frayab

+0

接受您的回答 – Mun0n

+0

在問題是48小時前不能接受自我回答。那麼這樣做是適當的。 –

0

也許你必須「凍結」 Form,使之不能滾動。設置Form不可滾動使用Form.setScrollable(false)並使您的BorderLayout的中心/北Container可滾動。嘗試做到這一點。

相關問題