Create a graphic application to display "Pokhara University" with Times New Roman font, Bold style and 20pt size

From Applets and Application chapter in PU/ Programming in Java

Asked on 1 Feb, 2021

Like 0 Dislike 204 Views

Add a comment

1 Answers

arjun adhikari on 1 Feb, 2021 Like 0 Dislike

import java.awt.* ;
import java.applet.* ;

/*
<applet code='FontDemo' height=400 width=400></applet>
*/

public class FontDemo extends Applet{
    
    public void paint(Graphics g){
    Font font = new Font("Times New Roman", Font.BOLD, 20) ;
    g.setFont(font) ;
    g.setColor(Color.blue) ;
    g.drawString("Pokhara University",20, 20) ;

    }

}

Output

Add a comment


Add your answer