Source Code : TextLayout demo

Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com. Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com. Click Here or search from google with Libraries Name you get jar file related it

TextLayout demo

TextLayout demo
     

import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.font.TextLayout;

import javax.swing.JFrame;
import javax.swing.JPanel;

public class TextLayoutOne extends JPanel {
  public void paint(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;

    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
        RenderingHints.VALUE_ANTIALIAS_ON);

    String s = "Java Source and Support.";
    Font font = new Font("Serif", Font.PLAIN, 32);

    TextLayout textLayout = new TextLayout(s, font, g2
        .getFontRenderContext());
    textLayout.draw(g2, 40, 80);
  }

  public static void main(String[] args) {
    JFrame f = new JFrame();
    f.getContentPane().add(new TextLayoutOne());
    f.setSize(300, 200);
    f.setVisible(true);

  }
}

           
         
    
    
    
    
  

Thank with us