Java2D opaque plastic look

Published on
5,611 Points
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...
        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


Featured Post

Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

Join & Write a Comment

Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
The viewer will learn how to implement Singleton Design Pattern in Java.

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month