Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.help > #1067
| From | Thomas Jensen <lianergoist@sejlgarnet.dk> |
|---|---|
| Subject | J2ME - List and Font |
| Newsgroups | comp.lang.java.help |
| Message-ID | <pan.2011.09.20.06.42.08@sejlgarnet.dk> (permalink) |
| Date | 2011-09-20 06:42 +0000 |
| Organization | SunSITE.dk - Supporting Open source |
Hi
I am trying to change the font size in a list. If I do this:
Font f = Font.getFont(0, 0, Font.SIZE_LARGE);
msglist = new myListClass("messages");
msglist.setFont(0, f);
msglist.setCommandListener(this);
display.setCurrent(msglist);
then the first element in the list is with large font. But if I try to do
the same in myListClass, it throw an exeption. What's wrong?
public final class myListClass extends List {
rec_class recs;
Vector data;
Font f = Font.getFont(0, 0, Font.SIZE_LARGE);
public myListClass (String lname)
{
super (lname, Choice.IMPLICIT);
recs = new rec_class(lname);
myRebuild();
}
public void myRebuild () {
deleteAll();
data = recs.getrecords();
int i = 0;
for (Enumeration e = data.elements(); e.hasMoreElements(); ) {
append((String)e.nextElement(), null);
setFont(0 /*i++*/, f);
}
}
}
--
Thomas Jensen, Denmark
Back to comp.lang.java.help | Previous | Next — Next in thread | Find similar
J2ME - List and Font Thomas Jensen <lianergoist@sejlgarnet.dk> - 2011-09-20 06:42 +0000
Re: J2ME - List and Font "John B. Matthews" <nospam@nospam.invalid> - 2011-09-20 14:01 -0400
Re: J2ME - List and Font Roedy Green <see_website@mindprod.com.invalid> - 2011-09-20 15:13 -0700
Re: J2ME - List and Font Roedy Green <see_website@mindprod.com.invalid> - 2011-09-20 15:18 -0700
Re: J2ME - List and Font Thomas Jensen <lianergoist@sejlgarnet.dk> - 2011-09-22 08:36 +0000
Re: J2ME - List and Font Thomas Jensen <lianergoist@sejlgarnet.dk> - 2011-09-22 10:36 +0000
Re: J2ME - List and Font Roedy Green <see_website@mindprod.com.invalid> - 2011-09-22 12:15 -0700
Re: J2ME - List and Font Roedy Green <see_website@mindprod.com.invalid> - 2011-09-22 12:17 -0700
csiph-web