2014-02-09 55 views
0

我有一個LWUIT表格,其中包含一個DefaultTableModel,它本身包含一些寫在 單元格上的值。LWUIT Table的單元格格式

我只是想改變我的表單元格格式。換句話說,我想將單元格中的值的方向從右向左而不是從左向右設置。

import javax.microedition.midlet.*; 

import com.sun.lwuit.*; 

import com.sun.lwuit.table.*; 

public class Format_Table_Cells extends MIDlet 
{ 

Form f; 

Table table1; 

DefaultTableModel model1; 

public void startApp() 

{ 
com.sun.lwuit.Display.init(this); 

f = new Form(); 

Object obj5 [][]= { { " "," ","row1"} , { " "," ","row2"} , { " "," ","row3"} }; 

model1 = new DefaultTableModel(new String[] { "column1" , "column2" ,"column3" } ,obj5); 

for(int j=0;j<obj5.length;j++) 

for(int col=0;col<obj5.length;col++) 

try 

{ 

model1.setValueAt(j, col, obj5[j++][col++]) ; 
} 

catch(java.lang.ArrayIndexOutOfBoundsException ee) 
{ 
} 
catch(java.lang.NullPointerException e3) 
{ 
} 

table1 =new Table(model1,true); 

f.addComponent(table1); 

f.show(); 

} 

public void pauseApp() 
{ 

} 

public void destroyApp(boolean unconditional) 
{ 

} 
} 

回答

0

我已經解決了這個問題,只是提出一個剩餘空間報價標誌

Object obj5 [][]= {    { " "," "," row1"} , { " "," "," row2"} , { " "," "," row3"} };