Total members 11355 |It is currently Wed Aug 20, 2014 9:27 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

All times are UTC [ DST ]



  Text Texture in java
Tue Nov 11, 2008 7:34 pm 

Text Texture in java
Code:
import java.awt.*;
import javax.swing.*;
import java.awt.image.*;

public class 
TextTexturedExample extends JPanel {
  public 
void paint(Graphics g) {
    
Graphics2D g2d = (Graphics2Dg;
    
Font font = new Font("Monotype Corsiva"Font.PLAIN40);
    
g2d.setFont(font);
    
String st "Java is an Object Oriented Programming Language.";
    
BufferedImage bufferedImage getTextureImage();
    
Rectangle rect = new Rectangle(00bufferedImage.getWidth(),
            
bufferedImage.getHeight());
    
TexturePaint texturePaint = new TexturePaint(bufferedImagerect);
    
g2d.setPaint(texturePaint);
    
g2d.drawString(st20100);
  }
  private 
BufferedImage getTextureImage() {
    
int s=10;
    
BufferedImage bufferedImage = new BufferedImage(ss,
             
BufferedImage.TYPE_INT_RGB);
    
Graphics2D g2d bufferedImage.createGraphics();
    
g2d.setPaint(Color.blue);
    
g2d.fillRect(0022);
    
g2d.setPaint(Color.green);
    
g2d.fillRect(20s2);
    
g2d.setPaint(Color.yellow);
    
g2d.fillRect(022s);
    
g2d.setPaint(Color.red);
    
g2d.fillRect(22ss);
  return 
bufferedImage;
  }
  public static 
void main(String[] args) {
    
JFrame f = new JFrame("Text Textured Example");
    
f.getContentPane().add(new TextTexturedExample());
    
f.setSize(760200);
    
f.show();
}



Attachments:
File comment: output
textTextured.gif
textTextured.gif [ 10.69 KiB | Viewed 1403 times ]

_________________
Please recommend / share my post if you found it helpful.
Author:
Mastermind
User avatar Posts: 2694
Have thanks: 73 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : Text Texture in java
 Java- Copy text area into disabled text area     -  
 add texture to cube3D     -  
 Add light to texture     -  
 how to attach a texture to polygon     -  
 Add texture to teapot object using     -  
 Text to speech in java     -  
 java Break Line for text     -  
 change Font of text in java     -  
 draw text effects in java     -  
 search for coding java/jsp for translation text     -  

All times are UTC [ DST ]



Topic Tags

Java Graphics






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team