2011-05-17 104 views
0

我想在我的EditField中加粗特定字母。黑莓EditField特定的文字以粗體顯示

public void changeToBold() { 
    try { 
     alphaSans = FontFamily.forName("BBAlpha Sans"); 
     font = alphaSans.getFont(Font.BOLD, 9, Ui.UNITS_pt); 
     editField.setFont(font); 
    } catch (ClassNotFoundException e) { 
     Dialog.alert("alert"); 
    } 
} 

public void changeToPlain() { 
    try { 
     alphaSans = FontFamily.forName("BBAlpha Sans"); 
     font = alphaSans.getFont(Font.PLAIN, 9, Ui.UNITS_pt); 
     editField.setFont(font); 
    } catch (ClassNotFoundException e) { 
     Dialog.alert("alert"); 
    } 
} 

我將文本從sqlite數據庫添加到EditField。

while(c1.next() && c2.next()) { 
      r1 = c1.getRow(); 
      r2 = c2.getRow(); 
      temp = r2.getString(0); 

      changeToBold(); 
      theText += temp; 
      changeToPlain(); 
      theText += r.1getString(0); 
     } 

*也許有一種方法可以創建擁有我的LabelField粗體wnat文本,然後同時將其添加到EditField中?

回答