106 How to change font size of Applet in Java

Code:
import java.applet.*;
import java.awt.*;
 
public class ActionButton extends Applet  {
 
  Button b ;
   
  public void init()
  {
   setBackground(Color.red);
   setForeground(Color.green);
  }
   
  public void paint(Graphics g)
  {
   Font currentFont = g.getFont();
   Font newFont = currentFont.deriveFont(currentFont.getSize() * 1.4F);
   g.setFont(newFont);
   g.drawString("Action Button Listner",10,20);
   showStatus("Coding Atharva is Here");
  }
}
 
/*
 <applet code="ActionButton" height=400 width=300 >
 </applet>
*/

Ouput:



Previous
Next Post »