我有一个LWUIT表,其中包含一个DefaultTableModel,它本身包含一些写入的值 它是细胞。
我只想更改表格的单元格格式。换句话说,我想在单元格中设置从右到左而不是从左到右方向的值的方向。
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 :(得分:0)
我已经解决了这个问题,只是留了一个空格留下引号
Object obj5 [][]= { { " "," "," row1"} , { " "," "," row2"} , { " "," "," row3"} };