Solved

How to make transparent backgroud in Java

Posted on 1998-06-18
4
181 Views
Last Modified: 2010-04-16
Now, I want to make the background color of my applet to be transparent with the background color of my HTML file. That means if the background color of my applet is blue while that of my HTML is red. I want there is on blue rectangular seen on web page. How can I do this? Of course, I can select the same color, but I want to have another alternative due to some reasons.
0
Comment
Question by:hcyu
  • 3
4 Comments
 

Expert Comment

by:baruche
ID: 1223374
To the best of my knowledge tranparency was only introduced at JDK 1.1 and even than only when you inherit from Component or Container, since Applet is derived from Panel (AFAIR) you cannot get tranparency from an Applet.
0
 
LVL 5

Expert Comment

by:fontaine
ID: 1223375
Do you mean that the background color of the Web page should impose the background
color of the applet or that the background color of the applet should impose the background
color of the HTML?
0
 
LVL 5

Accepted Solution

by:
fontaine earned 100 total points
ID: 1223376
Use the same background as the browser (if it is the inverse that you wanted, please tell
me).

In the applet tag, add a parameter:

PARAM NAME="bgColor" VALUE="B8B5AE"
(where VALUE is the same hexadecimal value as the HTML color value)

// in the JAVA init method :
Color bgcolor = new Color(Integer.valueOf(getParameter("bgColor"), 16).intValue());
setBackground(bgcolor);
0
 
LVL 5

Expert Comment

by:fontaine
ID: 1223377
"Pure" Blue : 0000FF
"Pure" Red:  FF0000
"Pure" Green: 00FF00
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
The viewer will learn how to implement Singleton Design Pattern in Java.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now