简体   繁体   中英

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM