Solved

How to make transparent backgroud in Java

Posted on 1998-06-18
4
215 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

735 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