?
Solved

How to make transparent backgroud in Java

Posted on 1998-06-18
4
Medium Priority
?
233 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 200 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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses
Course of the Month12 days, 2 hours left to enroll

752 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