How to set semi-transparent image to Shell background? - java

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/

Related

ExpandBar/ExpandItem background/foreground colors in Java SWT

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.

Clearing screen using scrollbars (Java)

I was going through this thread and I was wondering, if maybe we could use the scroll-bars to do that?
How to Use Scroll Panes describes how to do things using scroll bars. If I am making a terminal based application using Java for a Linux OS, then can't I use code that will move the terminal knob/scrollbar move down further? I mean, that is how even the BASH "clear" works, right? So, maybe this console-based Java app can move the console scroll down and pretend to clear the screen?
Now, my problem is that I am unable to find any class within this "Scroll Pane API" documentation that would help me do that. If anyone has worked with this API before can help me, it would be much appreciated!
..maybe we could use the scroll-bars to do that?
No. You cannot 'wrap the CLI in a JScrollPane (or add any JScrollBar instances)'. It is a native component that is outside the control (beyond textual output) of Java.

How to make overlay for video in swing

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.

Java Applet Transparency background

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

Guidelines to implement a minimal shape drawing tool desktop application using Java

We need to implement a Java desktop application that allows us (initially) to create / edit / resize / polygons on (initially) images. Then these polygons would be mapped to objects in our domain model.
So we basically need a toolbar with the options describe above and the possibility for the example to create a polygon on the an image and then scale it, or resize it, just that.
Do you know some library that could facilitate our work?
We've analyzed GEF, Picollo, NetBeans Visual API, Plain Swing or SWT/JFace, but none of them seems to help us to achieve our goal, which is, implement a really basic image editing tool.
I would like to mention that I'm not saying that what I want to do is not possible with the analyzed libraries, of course it can be done, but I'd like to learn from your experiences which is the correct path to take for this problem.
Any suggestion will be welcomed.
You could try to use GEF and the eclipse plataform.
this article could help you.
saluti
You might look at GraphPanel, a simple object drawing program. The control components are arranged in a JPanel, but JToolBar is a more flexible alternative.
Have you looked at imagine.dev.java.net? It is a NetBeans Platform application, which, though unfinished, might provide you with an interesting starting point.

Categories

Resources