<

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x

Java2D opaque plastic look

Published on
5,664 Points
2,664 Views
Last Modified:
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.

 
public void paint(Graphics2D g2d, Object arg1, int w, int h) {
    //your graphic code here...
    
    g2d.setPaint(
        new GradientPaint(
            0, 0, new Color(255, 255, 255, 150), 0, h, new Color(0, 0, 0, 0)
        )
    );
    
    g2d.fillRect(0, 0, w, h);
}

Open in new window

0
0 Comments

Featured Post

Exploring SharePoint 2016

Explore SharePoint 2016, the web-based, collaborative platform that integrates with Microsoft Office to provide intranets, secure document management, and collaboration so you can develop your online and offline capabilities.

This video teaches viewers about errors in exception handling.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month