dcsimg
How to create Transparent TextArea in Java Application
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Robert_wee
Posted On:   Monday, September 22, 2003 08:28 PM

I would like to ask whether how can i make the TextArea in Java Application transparent. I need it as i have a beautiful background at the back of the TextArea.

Re: How to create Transparent TextArea in Java Application

Posted By:   Bahman_Barzideh  
Posted On:   Tuesday, September 23, 2003 05:28 AM

I have done a similiar thing with Swing component. I am not sure if this is going to work with AWT components but you can try it:



There are two steps involved. First set the background color of the
TextArea. Take a look at Color. you will notice
it supports an alpha value. This is the opacity of the color. By default
you don't specify the opacity. This results in a color that is fully opaque.
To make the color see-through specify an alpha value [range is 0 - 255; I suggest you start with128 and experiment with it).
Second, you need to identify every component that lies between your
TextArea and the "beauty of a background" (e.g. the scroll pane the TextArea may be sitting in) and make them
trnasparent (set their background color to anything with an alpha of 0).



Please note that with a Swing component, the second step is
accomplished by simply invoking the setOpaque () method of each intervenning component and passing it a value of false. Unfortunately, AWT components do not support this method. Hence the above attempt at making the
intervenning components transparent.
About | Sitemap | Contact