Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

11991 Posts in 1587 Topics- by 3509 Members - Latest Member: lioneltenel

27. May 2012, 02:47:16 am
Xith3D CommunityGeneral CategorySupport (Moderator: Marvin Fröhlich)Overlaying swing objects above Canvas3D
Pages: [1]
Print
Author Topic: Overlaying swing objects above Canvas3D  (Read 1345 times)
AotFSteven
developers
Enjoying the stay
***
Offline Offline

Posts: 63


View Profile
« on: 08. January 2008, 07:50:05 am »

Hi everyone, I am new to Xith so please forgive me if this answer is known (I couldn't find it by searching).  I was wondering if it is possible to display swing elements, like a JInternalFrame, over the Canvas3D object.  When I tried messing around with the BSPLoaderTest by putting it in a JInternalFrame and creating another JInternalFrame when moving the other JInternalFrame it goes over the border of the other containing the Canvas3D like it is supposed to, but it gets covered by the Canvas3D object.  I know that there are widget elements available to use, but I wanted to have a frame that was broken up into different parts with only part of it being taken up by the Canvas3D.  Certain buttons would create popups that I want to be able to move over the entire frame, hence the JInternalFrames.  I was assuming that if the Canvas3D was smaller it would cost less, is this correct?  Thanks in advance.
Logged
Jonas
Just dropped in

Offline Offline

Posts: 5


View Profile
« Reply #1 on: 08. January 2008, 08:53:08 am »

Hi
Have you used the Canvas3DPanel? If so..mixing heavy(AWT panel) and lightwight(JInternalFrame) usually sucks(should be fixed in jdk7). See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4154448
What usualy works for me is embedding the Panel in a JPanel(i guess that works with other LW components too) an then adding that JPanel to whatever swing component you want to have it in the first place. I never used JInternalFrame so im not sure here...

In case of pop ups..those can be made heavyweight so they draw over your canvas3d.
Code:
mypopup.setDefaultLightWeightPopupEnabled(false)

You might also try Canvas3DJPanel which is lightweight swing by nature..someone mentioned its slower though. But anything else is kinda hackis  Smiley

Logged
Mathias 'cylab' Henze
Fierce Warrior
****
Offline Offline

Posts: 540

1064620
View Profile WWW
« Reply #2 on: 08. January 2008, 09:46:51 am »

Using heavyweight components in conjunction with JInternalFrame does not work correctly. If performance are no problem in your application, you could use JOGL_SWING as OpenGLLayer, so the Canvas3D is also lightweight.
Logged

AotFSteven
developers
Enjoying the stay
***
Offline Offline

Posts: 63


View Profile
« Reply #3 on: 08. January 2008, 08:39:14 pm »

I had originally been using the Canvas3DPanel and when that wasn't working and after I looked on the forums for a little bit I discovered the Canvas3DJPanel, but this did not seem to fix the problem, but I didn't really mess around with it.  I will try to Popup to see what kind of popups I can create (I haven't really worked with those) to see if they will meet my needs.

Using heavyweight components in conjunction with JInternalFrame does not work correctly. If performance are no problem in your application, you could use JOGL_SWING as OpenGLLayer, so the Canvas3D is also lightweight.

unfortunately performance is a problem with my application and according to this article http://today.java.net/pub/a/today/2007/08/09/looking-ahead-to-java-7.html it doesn't look like JDK 7 is coming out until 2009.

Thank you both for the help.
Logged
Jonas
Just dropped in

Offline Offline

Posts: 5


View Profile
« Reply #4 on: 08. January 2008, 09:29:20 pm »

Hi

Ouch. I was actually looking forward to those fixes too. Until then...don't Swing Grin.

Is SWT any better? Anyone knows? If my understanding is right SWT is heavyweight only and avoids such problems like AWT/Swing? How good is the Xith support for SWT?
Logged
Mathias 'cylab' Henze
Fierce Warrior
****
Offline Offline

Posts: 540

1064620
View Profile WWW
« Reply #5 on: 08. January 2008, 10:20:02 pm »

The problem here is mixing it with JInternalFrame. Just use other Swing containers and do normal Dialogs for popups. Context and application menues can be made heavyweight by calling JPopupMenu.setDefaultLightWeightPopupEnabled(false) somewhere in your applications main method.
Logged

Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #6 on: 08. January 2008, 10:35:23 pm »

Is SWT any better? Anyone knows? If my understanding is right SWT is heavyweight only and avoids such problems like AWT/Swing? How good is the Xith support for SWT?

For SWT questions it is best to directly send a PM to horati, who used to manage SWT integration and who will be able to answer your questions.

Marvin
Logged
AotFSteven
developers
Enjoying the stay
***
Offline Offline

Posts: 63


View Profile
« Reply #7 on: 09. January 2008, 03:36:00 am »

The problem here is mixing it with JInternalFrame. Just use other Swing containers and do normal Dialogs for popups. Context and application menues can be made heavyweight by calling JPopupMenu.setDefaultLightWeightPopupEnabled(false) somewhere in your applications main method.

Thanks a lot, hopefully I can use the Dialogs in a similar way that I was going to use the JInternalFrames.  By the way, when you said normal Dialogs you meant the awt Dialog and not JDialog right?
Logged
AotFSteven
developers
Enjoying the stay
***
Offline Offline

Posts: 63


View Profile
« Reply #8 on: 09. January 2008, 03:48:31 am »

Thanks Mathias I just looked into JDialogs and found that they work fine.  I haven't used swing elements in a while and when you mentioned JDialogs I was think of the JOptionPanes which is why I was wondering if I would be able to do what I wanted with them.  Anyways, the JDialogs should work perfectly.  Thanks again.
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic