Unicode: Fonts and Text Rendering : Code Unicode : Development Class : Java examples (example source code) Organized by topic

Java
C++
PHP
Java Home »  Development Class   » [  Code Unicode  ]  Screenshots 
 



Unicode: Fonts and Text Rendering




/*
Java Internationalization
By Andy Deitsch, David Czarnecki

ISBN: 0-596-00019-7
O'Reilly
*/
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, 5075);
  }

  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);
  }
}



           
       
Related examples in the same category
1.  Unicode sorting Unicode sorting
2.  Unicode: TrueType Font Test Unicode: TrueType Font Test
3.  Unicode: test layout Unicode: test layout
4.  Conversion between Unicode characters and Strings Conversion between Unicode characters and Strings
5.  Convert among Unicode, ASCII and byte/int Convert among Unicode, ASCII and byte/int
6.  Unicode - show a page of Unicode characters
7.  Vis - make special characters visible
8.  Demonstrate creating readers and writers with a specific encoding
9.  TextArea with Unicode TextArea with Unicode
10.  Unicode display Unicode display
11.  Internationalized Graphical User Interfaces: unicode cut and paste Internationalized Graphical User Interfaces: unicode cut and paste
12.  Stream Converter Unicode Stream Converter Unicode
13.  String Converter Unicode String Converter Unicode
























Home| Contact Us
Copyright 2003 - 04 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.