Java GraphicsEnvironment .registerFont (Font font)

Syntax

GraphicsEnvironment.registerFont(Font font) has the following syntax.

public boolean registerFont(Font font)

Example

In the following code shows how to use GraphicsEnvironment.registerFont(Font font) method.


/*  w w w.j  a  v  a 2s . c o  m*/
import java.awt.Font;
import java.awt.GraphicsEnvironment;

public class Main {
  public static void main(String[] args) {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    ge.registerFont(new Font("New Font",Font.BOLD,20));
    
  }
}




















Home »
  Java Tutorial »
    java.awt »




BasicStroke
BorderLayout
CardLayout
Color
Cursor
Desktop
DesktopManager
DisplayMode
EventQueue
FlowLayout
FocusTraversalPolicy
Font
FontMetrics
GradientPaint
Graphics
Graphics2D
GraphicsConfiguration
GraphicsDevice
GraphicsEnvironment
GridBagConstraints
GridBagLayout
GridLayout
Image
ItemSelectable
KeyboardFocusManager
LayoutManager
LayoutManager2
Point
Rectangle
Robot
Shape
SplashScreen
SystemColor
SystemTray
TexturePaint
TrayIcon
Toolkit
Transparency