2014-04-16 6 views
1

tableView에 삽입 된 레이블에서 글꼴을 늘리려고하고 있지만 다음 코드는 작동하지 않습니다. 레이블이나 텍스트의 배경색에만 영향을 미칠 수있는 것처럼 보입니다.tableView blackberry의 레이블 글꼴을 늘리십시오.

내 표식을 채우는 방법입니다. 모든 레이블에 4 가지 방법을 사용했지만 그 중 아무 것도 작동하지 않습니다! 나는 우리가 블랙 베리 테이블보기에서 라벨의 크기를 편집 할 수 없습니다 테스트의 일 후에 발견 무엇

private void createTableView() { 

    // Initialize the model if it has not yet been loaded 
    _tableModel = new SortedTableModel(StringComparator.getInstance(true), 
      0); 

    // Populate the list 
    for (int i = 0; i < 2; i++) { 

     _tableModel.addRow(new Object[] { "" }); 
    } 

    // Create and apply style 
    RegionStyles style = new RegionStyles(BorderFactory.createSimpleBorder(
      new XYEdges(1, 1, 1, 1), Border.STYLE_SOLID), null, null, null, 
      RegionStyles.ALIGN_LEFT, RegionStyles.ALIGN_TOP); 

    // Create the view and controller 
    TableView tableView = new TableView(_tableModel); 
    TableController tableController = new TableController(_tableModel, 
      tableView); 

    // Set the behaviour of the controller when a table item is clicked 

    tableView.setController(tableController); 
    tableController.setFocusPolicy(0); 

    // Create a DataTemplate that suppresses the third column 
    DataTemplate dataTemplate = new DataTemplate(tableView, 1, 2) { 
     /** 
     * @see DataTemplate#getDataFields(int) 
     */ 
     public Field[] getDataFields(int modelRowIndex) { 

      Field[] fields = new Field[2]; 

      if (modelRowIndex == 0) { 
       fields[0] = new LabelField(" Company name") { 
        public void paint(Graphics graphics) { 
         Font font = Font.getDefault().derive(Font.PLAIN, 6, 
           Ui.UNITS_pt); 
         graphics.setFont(font); 
         graphics.setColor(Color.BLUE); 
         super.paint(graphics); 
        } 
       }; 
       LabelField somethingLabel = new LabelField("some Name", 
         USE_ALL_HEIGHT | USE_ALL_WIDTH) { 
        public void paint(Graphics graphics) { 
         graphics.setColor(Color.BROWN); 
         super.paint(graphics); 
        } 
       }; 
       Font font = Font.getDefault().derive(Font.PLAIN, 6, 
         Ui.UNITS_pt); 
       somethingLabel.setFont(font); 
       fields[1] = somethingLabel; 
      } else { 
       fields[0] = new LabelField(" Shipping Date") { 
        public void paint(Graphics graphics) { 
         graphics.setColor(Color.BLUE); 
         super.paint(graphics); 
        } 
        protected void layout(int width, int height) { 
         // TODO Auto-generated method stub 
         int fontHeight = getFont().getHeight(); 
         setExtent(width, fontHeight + 30); 
        } 
       }; 
       LabelField dateLabel = new LabelField("some Date", 
         USE_ALL_HEIGHT | USE_ALL_WIDTH) { 
        public void paint(Graphics graphics) { 
         graphics.setColor(Color.BROWN); 
         super.paint(graphics); 
        } 
       }; 
       Font myFont = Font.getDefault().derive(Font.BOLD, 9, Ui.UNITS_pt); 
       dateLabel.setFont(myFont); 
       fields[1] = dateLabel; 
      } 
      return fields; 
     } 
    }; 

    // Set up regions 
    // dataTemplate.createRegion(new XYRect(0, 0, 1, 2), style); 
    dataTemplate.createRegion(new XYRect(0, 0, 1, 1), style); 
    dataTemplate.createRegion(new XYRect(1, 0, 1, 1), style); 

    // Specify the size of each column by percentage, and the height of a 
    // row 
    dataTemplate.setColumnProperties(0, new TemplateColumnProperties(40, 
      TemplateColumnProperties.PERCENTAGE_WIDTH)); 
    dataTemplate.setColumnProperties(1, new TemplateColumnProperties(60, 
      TemplateColumnProperties.PERCENTAGE_WIDTH)); 

    dataTemplate.setRowProperties(0, new TemplateRowProperties(ROW_HEIGHT)); 

    // Apply the template to the view 
    tableView.setDataTemplate(dataTemplate); 
    dataTemplate.useFixedHeight(true); 
    content1.add(tableView); 

} 

답변

1

, 우리는 색상과 배경,하지만 어느 크기 나 글꼴을 편집 할 수 있습니다.