BlackBerry 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 来保存我想要的粗体文本,然后将其同时添加到 EditField 中?
I want to bold specific letters in my 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");
}
}
I add the text to the EditField from a sqlite db.
while(c1.next() && c2.next()) {
r1 = c1.getRow();
r2 = c2.getRow();
temp = r2.getString(0);
changeToBold();
theText += temp;
changeToPlain();
theText += r.1getString(0);
}
*Maybe there is a way to create a LabelField that holds the text I wnat in bold and then add it simultaneously to the EditField?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要使用 RichTextField< /a>.请参阅 如何 - 在 RichTextField 中设置文本格式作为示例。
You need to use RichTextField. See How To - Format text in a RichTextField for an example.