Solved

transparent canvas

Posted on 1997-10-13
2
876 Views
Last Modified: 2012-06-21
I have an applet with a panel.  I add canvas' to it, and I use the mouseDrag method to allow the user to move the graphics around the "desktop".  I couldn't use the mouseDrag if I didn't use the canvas.  But now I have to put transparent gifs in for graphics, but you only see the background of the canvas that the image is in through the transparency of the gif.  Is there any way to have the canvas be transparent so I can see the other images through the transparencies?

Seth
0
Comment
Question by:seth23
2 Comments
 
LVL 1

Accepted Solution

by:
mnelson051997 earned 100 total points
ID: 1228524
The way to have a transparent component is to use
the Component class instead of Canvas.  Using
Component means there is no peer involved, so if
you don't paint in an area, and update() is not
filling in the background, you see straight through.
This is what the JDK 1.1 calls a "lightweight"
component.
0
 

Author Comment

by:seth23
ID: 1228525
I am waiting to grade this.  I just asked another question about this problem, having to do with a problem that arises when I make the canvas into a component, and I can't test the transparency problem until the other problem is fixed.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Java array passed to SQL where clause 23 64
mockito example issue 8 64
Java Loop 6 50
xampp tool 12 30
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
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…
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 will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

863 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

17 Experts available now in Live!

Get 1:1 Help Now