How to make transparent backgroud in Java

Posted on 1998-06-18
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.
Question by:hcyu
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3

Expert Comment

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.

Expert Comment

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?

Accepted Solution

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

In the applet tag, add a parameter:

(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());

Expert Comment

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

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
null output 3 55
Java pass by reference 3 69
How does initial implicit objects  are set up in JSP? 7 37
Java import explained 4 44
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…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
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…
Suggested Courses

738 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