Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: Java
Expertise: Beginner
Feb 3, 2000



Application Security Testing: An Integral Part of DevOps

Let Your Text Throw A Shadow

It is very easy to add a shadowy effect to drawn text in Java. All we have to do is to pick a darker color for the shadow and draw it near the center of the original text that we want to shadow. The code snippet below does just that on the drawing context of a JLabel.
        Graphics g = JLabel1.getGraphics(); 
        g.setColor(new Color(120, 120, 120)); 
        int x = 20; 
        int y = 20;        
        int fontSize = 22; 
        Font font = new Font("ariel", Font.BOLD, fontSize); 
        g.drawString("Shadow", x+2, y+2); 
        g.setColor(new Color(220, 220, 220)); 
        g.drawString("Shadow", x, y); 
Behrouz Fallahi
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date