Navigate User Interface topic:v  d  e )


Computer code Code listing 9.5: Drawing text
public class MyCanvas extends Canvas {
    public void init() {
        setFont("Times New Roman", Font.PLAIN, 24);
        setColor(Color.white);
        setBackGroundColor(Color.black);
        setLayout(new GridLayout());
 
        add(label);
        add(button);
    }
}