jkigel
jkigel

Reputation: 1592

BlackBerry EditField specific text in bold

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?

Upvotes: 0

Views: 505

Answers (1)

Swati
Swati

Reputation: 52747

You need to use RichTextField. See How To - Format text in a RichTextField for an example.

Upvotes: 1

Related Questions