Add transparent JPanel upon AWT Component to paint on - java

I've got a Problem: In my Java application I've got an AWT Component (cannot change that one) that streams and shows an avi-file. Now I want to draw upon this movie and thought about putting a transparent JPanel above it and draw on that one.
This does not work since I either see the avi-stream or the drawn lines but not both.
I read somewhere that AWT does not support transparency of components - but the panel is a JPanel which is able to do so.
Can someone please help me with this one - thanks in advance.

The Mixing Light and Heavyweight Components article explains how this is handled only in the most recent version of the JDK.

did you try a GlassPane since i think thats exactly it's use case. soemthing like JFrame.setGlassPane() if i remember correctly. check here:
Java API JFrame
GlassPane examples

I've searched for a heavyweightcomponent that could help me but I didn't found one, and regarding the internalframes I don't know how you managed to set the opacity to 50. All what I found about seetting the opacity wast the method setOpaque(boolean value) and this doesn't help me at all. Would you please explaine me how did you set that opacity. It's my final alternative either that or I'll have to change my entire project design.

Try running Stream and Drawing on separate thread. I think this can help

Related

What could probably go wrong? Using getContentPane() as default layer JPanel

I found out I can use (JPanel) frame.getContentPane() easily as default layer JPanel, even with borders. (Which was surprising to me at first.)
Is this a common/uncommon/good/bad behavior? Why?
While doing this: What coul probably co wrong?
Read the section from the Swing tutorial on Adding Components to the Content Pane for a brief discussion on this topic.
There is no real drawback. Your posted code already addresses the issue, mentioned in the link.

java fixed textpane area get scrollbar if necessary

I'm trying to make a GUI in java, and I want to make an interface where I have multiple textpanes with a fixed area, and, as such, depending on the width of the window, I may get a scrollbar if necessary
like this
what is the best way to achieve something like this? thank you
JScrollPane can be used in such a case. Here's the official tutorial: http://docs.oracle.com/javase/tutorial/uiswing/components/scrollpane.html

How to resize controls at runtime in java

Is there a way to resize a control, a JTextfield for example, at runtime in java? I want my textfield to have the resize cursors (just like when you point your cursor on the corner of a window) and will be able to resize on runtime. Ive read on the internet that vb6 and C# have those capabilities, is there anything for java? A sample code or a link to a good tutorial will be very much appreciated. Thank you.
It sounds like you are trying to implement a component editor, such as the GUI editors available in popular programing IDEs. The essential feature is a handle, a graphical object that can be selected and dragged to change the geometry. GraphPanel is a simple example of an object drawing program that illustrates many of the required techniques.
That depends on the Layout of the JTextField's container. A good tutorial is available at http://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html
For a quick and cheap solution you could use a JSplitPane component, with the JTextField to be resized in the left side, and an empty JPanel in the right side. By default a JSplitPane is decorated with a border and a divider, but you can remove these by setting an empty border.

Transparent Window

I have a fullscreen JFrame. I added a map to JPanel then added it to JFrame. Now I want to add a transparent window to JFrame. I want to see all map and I want to move transparent window.
I did it with internal frame but I couldn't it's title tranparent.
Could you help me about this?
Thanks ...
One possible way is to add a JPanel to the glasspane.
Does com.sun.awt.AWTUtilities.setWi­ndowOpacity(this, 0.3f); work? (although it's not an officially supported API, natch). Regardless, there's an article on this here.
http://techgearup.wordpress.com/2008/09/19/transparent-jframe-background/
This might help... as a starting point, at least.
If you´r having truble finding it on google it could be because you'll have to google "Translucent"
http://java.sun.com/developer/technicalArticles/GUI/translucent_shaped_windows/

ComboBox items are overlapped

Please have a view of the attached image.
I use VLCJ to build this application. However, it is unexpected that the item in combobox is hidden by the Canvas (which is used in VLCJ player). How to solve it?
Depending on the jre version the following line may help:
comboBox.setLightWeightPopupEnabled(false);
which tells swing to use a heavyweight dropdown instead of a lightweight one.
Similar issue has been answered here, Swing: Canvas overlaps menu.
NB:
A comment on the answer there is suggesting the use of JComponent instead of a Canvas. Consider that.

Categories