FileDocCategorySizeDatePackage
DrawStringDemo.javaAPI DocExample790Sun Jan 07 16:08:44 GMT 2001None

DrawStringDemo.java

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class DrawStringDemo extends JFrame {

  String message = "David says, \"\u05E9\u05DC\u05D5\u05DD \u05E2\u05D5\u05DC\u05DD\"";
  public DrawStringDemo() {
    super("DrawStringDemo");
  }

  public void paint(Graphics g) {
    Graphics2D graphics2D = (Graphics2D)g;
    GraphicsEnvironment.getLocalGraphicsEnvironment();
    Font font = new Font("LucidaSans", Font.PLAIN, 40);
    graphics2D.setFont(font);
    graphics2D.drawString(message, 50, 75);
  }

  public static void main(String[] args) {
    JFrame frame = new DrawStringDemo();
    frame.addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent e) {System.exit(0);}
    });

    frame.pack();
    frame.setVisible(true);
  }
}