1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
/* Change Checkbox Font Example This java example shows how to change checkbox font using AWT Checkbox class. */ import java.applet.Applet; import java.awt.Checkbox; import java.awt.Font; /* <applet code="ChangeCheckboxFontExample" width=200 height=200> </applet> */ public class ChangeCheckboxFontExample extends Applet{ public void init(){ //create checkboxes Checkbox checkbox1 = new Checkbox("Checkbox 1"); Checkbox checkbox2 = new Checkbox("Checkbox 2"); /* * To change font of a checkbox use * setFont(Font f) method. */ Font myFont = new Font("Courier", Font.ITALIC,12); checkbox1.setFont(myFont); //add checkboxes add(checkbox1); add(checkbox2); } } |
Example Output
Add Comment