当前位置: 动力学知识库 > 问答 > 编程问答 >

how to create ListView or TableView like calendar in blackberry

问题描述:

how can i create a view like calendar in blackberry and every list have a different color (example : blue for odd row and white for even-numbered row).

I want a structure like below

text | text | text | text | text | text | text | text | text | text | text | text

text | text | text | text | text | text | text | text | text | text | text | text

text | text | text | text | text | text | text | text | text | text | text | text

text | text | text | text | text | text | text | text | text | text | text | text

text | text | text | text | text | text | text | text | text | text | text | text

text | text | text | text | text | text | text | text | text | text | text | text

text | text | text | text | text | text | text | text | text | text | text | text

text | text | text | text | text | text | text | text | text | text | text | text

other sample, like an image in this link --> http://appworld.blackberry.com/webstore/content/14535/

i use blackberry jde 4.7.

thanks

网友答案:

Try this -

int k;
LabelField l;

GridFieldManager grid = new GridFieldManager(9,4,0); //First parameter for row,second for column
    for (int i = 1; i < 37; i++) {
        k=i%2;
         if(k!=0){
             l=new LabelField(""+i)
             {
                 public void paint(Graphics graphics)
                 {
                 graphics.setColor(Color.RED);
                 super.paint(graphics);
                 }
             } ;
         }else{
             l=new LabelField(""+i)
             {
                 public void paint(Graphics graphics)
                 {
                 graphics.setColor(Color.BLUE);
                 super.paint(graphics);
                 }
             } ;
         }

         grid.add(l);

    }
     grid.setColumnPadding(30);
     grid.setRowPadding(30);
     add(grid);
分享给朋友:
您可能感兴趣的文章:
随机阅读: