Zoo tutorials: [ SQL | Linux | XML ]
ProgZoo: [ Java | C# | VB | C++ | Perl ]
Log in

A Gentle Introduction to
C++ Programming

Tutorial: Fonts

 

We can set the font of a Graphics object. String get drawn in the current font.

There are two ways to obtain font to suppliy to the setFont method:

Note that we never change a font - we alway create a new one.

1. Font example


Big


Notice:
  • g already has a font that we can use
  • if we use a constructor we need the word new.
  • The GraphicsEnvironment has no constructor. We use a static method to obtain our current one.