Tue Nov 11, 2008 8:28 pm
import java.awt.*;
import javax.swing.*;
import java.awt.geom.*;
public class ShowTransparentText extends JPanel {
public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
Ellipse2D ellipse = new Ellipse2D.Double(45, 45, 500, 120);
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.ITALIC, 30));
g2d.drawString("Java is an Object Oriented Programming language.",10, 110);
}
public static void main(String[] args) {
JFrame frame = new JFrame("Show Transparent Text");
frame.getContentPane().add(new ShowTransparentText());
frame.setSize(700, 200);
frame.setVisible(true);
}
}
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.