I am developing a Java applet which uses PNG-24 for icons. These icons are transparent but they simply refuse to be transparent in the app. The background always ends up white.
Is anyone familiar with this are and can give any pointers?
Thanks Mathias.
This page seems to give some ideas:
http://www.rgagnon.com/javadetails/java-0265.html
Katrien
Related
I am developping an SWT application, and I want to give the application a background png,but setBackgroundImage is not support transparent. Is there any way to solve the problem? There are some semi-transparent pixels , I wish to see desktop on these positions.
ps the shell is no-trim style
Have you tried looking around on the net? I found this, think it should help you
http://git.eclipse.org/c/platform/eclipse.platform.swt.git/plain/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet180.java
You can also refer here for some more examples which can help you later on
http://www.eclipse.org/swt/snippets/
I am developing a j2me midlet application with netbeans how ever I am new to java but I have developed all things i need. But I cannot change background color or image when I run the jar file on mobile it show a transparent or white color background is there any possible way to change background color or image any answered will be appreciated.
You cannot do anything about the background when working with High Level GUI (meaning Form stuff).
If you want to control the background, you'll need to use Canvas - but Form elements can't be used on a Canvas.
Best option then is to use LWUIT. It gives you a set of elements like you have with Form, but because it uses Canvas you have much more options and such.
I'm looking to manage colors of headers of my expandItem in SWT, and I'm not able to change the background or the foreground (swt gtk 32bit) or only background (swt win 64).
Is there some particular way to do that?
I'm already setting:
exp_bar.setBackground(new Color(display, GUISetting.MAIN_BACKGROUND));
exp_bar.setForeground(new Color(display, GUISetting.MAIN_TEXT_COLOR));
But this does not seem to work.
Any ideas?
According to this page, this behaviour is intended. The widgets are supplied by the OS. The OS uses a texture and SWT decided, that you cannot set the color on a widget with a texture.
There is a bug report here that you can support.
However, these posts are quite old (2006). Maybe it was fixed till now, but I couldn't find anything...
In SWT, these widgets are supplied by OS. if you look at documentation setBackground(), it says the parameters are just hints. they might be honored or not, it all depends on OS.
I want to make a transparent overlay for a foreign project to show live video. Sample of overlay is given in the image link below. In image you can see a overlay at right bottom corner showing face of a person, I also want to achieve same functionality using JMF to show face and then display the face in overlay using swing.
Sample Overley Imahe: http://www.ovostudios.com/images/vidsamsolo.jpg
Can someone help achieving this functionality?
If you're just starting the project and haven't actually got the JMF part up and running yet, then you might want to take a look at some alternatives before committing to it.
If you want to go ahead with Swing, to get the general overlay behaviour you want, you'll need to make use of Frame.setUndecorated() to turn off window borders and buttons, and Window.setAlwaysOnTop() to make sure the window stays on top of other windows. For the transparency, see this tutorial. However, I'm not sure whether transparency and video will work nicely together, so good luck!
You might also want to write a custom focus handler for the window so that it cannot be focused, although it is probably impossible for the overlay to be properly 'phantom' whereby clicks just pass through the overlay to the underlying desktop. That kind of behaviour might only be possible by using low-level graphics techniques i.e. by not creating a window at all, but by drawing directly onto the screen. That might require a native library.
Is it possible to simply paint() (or use some other function) to the screen in Java? As in draw over everything else on some coordinates of the screen itself, not inside some window.
If not, is it possible to make an invisible window that takes up the entire screen and use its glass pane to do it? Would complications arise from doing this? (Such as not being able to click on other applications)
Are there any other ways?
Thanks.
Edit: I'm not trying to do full screen with this, by the way.
When you paint() in Java, you're painting only within the confines of the size and location of what is being paint()ed.
If you're looking to do full screen stuff, there are tutorials for that:
http://download.oracle.com/javase/tutorial/extra/fullscreen/index.html
In theory, you can create an transparent undecorated maximized JFrame. This will allow you to "paint" over the desktop. Problems are obvious: if an application stays behind this window, it will not receive any mouse events.
Months ago, I made an evil cheat to draw directly on Windows Explorer's Desktop: mixing some .NET coding with JNI and Sun's internal classes - that's surreal, but works.