Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to create a transparent rectangle

899398Nov 22 2011 — edited Nov 22 2011
Hi,

I want to create a transparent rectangle which may not cover the background image. Is any one here can help me to revise the code?

Thanks,

-Leo
    private Rectangle createSelectWindow(final Color color, double length) {
        //create a circle with desired name,  color and radius
        final Rectangle rect = new Rectangle(length, length);

        
        //rect.setFill(Color.WHITESMOKE);
        rect.setStroke(Color.WHITESMOKE);

        //add a transparent effect
        Blend blend = new Blend();
        blend.setMode(BlendMode.SCREEN);        
        blend.setOpacity(1.0);
        rect.setEffect(blend);
        //change a cursor when it is over circle
        rect.setCursor(Cursor.HAND);
        return rect;
}
Edited by: leo on Nov 22, 2011 12:45 AM
This post has been answered by zonski on Nov 22 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 20 2011
Added on Nov 22 2011
1 comment
371 views