Solved

How to make transparent backgroud in Java

Posted on 1998-06-18
4
227 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
[X]
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
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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

In this post we will learn different types of Android Layout and some basics of an Android App.
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
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 …
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…

687 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