public void Destroyapp (Boolean unconditional) {
}
public void Commandaction (Command C, displayable D) {
if (C==exitcommand) {
Destroyapp (FALSE);
Notifydestroyed ();
}
else {
Select the face and size
Face=facechoice.getselectedindex ();
Switch (face) {
Case 0:face=font.face_proportional;break;
Case 1:face=font.face_monospace;break;
Case 2:face=font.face_system;break;
}
Size=sizechoice.getselectedindex ();
switch (size) {
Case 0:size=font.size_small;break;
Case 1:size=font.size_medium;break;
Case 2:size=font.size_large;break;
}
Select the style
Boolean[] Styleselect =new boolean[4];
for (int i=0;i<4;i++) {
if (stylechoice.isselected (i) &&i==0) {
Style |= Font.style_plain;
}
else if (stylechoice.isselected (i) &&i==1) {
Style |=font.style_bold;
}
else if (stylechoice.isselected (i) &&i==2) {
Style |=font.style_italic;
}
else if (stylechoice.isselected (i) &&i==3) {
Style |=font.style_underlined;
}
public void Commandaction (Command C, displayable D) {
if (C==backcommand) {
Adisplay.setcurrent (Choiceform);
}
}
}
}
This program is mainly to deepen the understanding of canvas's font.
The constructor for the 1.MIDlet class should be public canvas2let () and not public void Cancas2let (). The object of the class is not returned because the void is added, causing the program to run without reflection. This is a lesson.
2. In canvas, you need to use code
G.setcolor (0xFFFFFF);
G.fillrect (0,0,getwidth (), getheight ());
To clear the previous interface. Then use G.setcolor (0) to set the painting color.
3. In this connection, it should be understood that:
Now that you're using a low-level interface, that means everything on the screen is up to you, and you have the biggest right. But you also have a corresponding obligation to clear the screen of work naturally also want you to do
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.