Switch to full style
General Java code examples
Post a reply

Transparent Text

Tue Nov 11, 2008 8:28 pm

draw Transparent Text in java
Code:
import java.awt.*;
import javax.swing.*;
import java.awt.geom.*;

public class 
ShowTransparentText extends JPanel {
  public 
void paint(Graphics g) {
    
Graphics2D g2d = (Graphics2Dg;
    
Ellipse2D ellipse = new Ellipse2D.Double(4545500120);
    
g2d.setPaint(Color.black);
    
g2d.fill(ellipse);
   
    
Composite comp AlphaComposite.getInstance(AlphaComposite.SRC_OVER.6f);
    
g2d.setComposite(comp);
    
g2d.setPaint(Color.red);
    
g2d.setFont(new Font("Book Antiqua"Font.ITALIC30));
    
g2d.drawString("Java is an Object Oriented Programming language.",10110);
  }
  public static 
void main(String[] args) {
    
JFrame frame = new JFrame("Show Transparent Text");
    
frame.getContentPane().add(new ShowTransparentText());
    
frame.setSize(700200);
    
frame.setVisible(true);
  }



Attachments
transparent.gif
Transparent text in java
transparent.gif (9.19 KiB) Viewed 7275 times

Post a reply
  Related Posts  to : Transparent Text
 Making Colors Transparent with imagecolortransparent()     -  
 opacity of HTML element- transparent     -  
 Difference between Opaque,Transparent and Translucent Images     -  
 Able to Copy Text from Uneditable Text Boxes(JTextfields)     -  
 Java- Copy text area into disabled text area     -  
 Get Text Field value by php     -  
 Flaming Text     -  
 text like a curve     -  
 Aligning the text within the div tag     -  
 i tag for italic text     -  

Topic Tags

Java Graphics