jogl + swing help, please.

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

jogl + swing help, please.

imakerobots
Hi Jogamp!

I love what you're doing, I think it's a Good Thing.

I've been writing code for my robot interfaces using Eclipse and Swing.  Up to now I've been overriding a jpanel::paintComponent() to do my WYSIWYG.  Fine for robots like Makelangelo.com, not so great when I get into stuff that moves in 3D.  I'd really like to bring all my robots under one roof, so to speak - opengl jpanel in one window, context-sensitive swing components in another window.  click on a robot to change the panel, tweak the panel to order the robot around.  I want to believe I don't have to rewrite all the GUI to run natively in OpenGL.

I'm currently working on https://github.com/marginallyclever/arm3. I have a simple menu bar above a jogl window.  I find that when I select a drop down menu the menus stop working until I resize the window or switch out and back in again.

In a separate, unreleased codebase, I tried a jSplitPanel with jogl on the left and swing components on the right.  the jogl window refused to resize correctly, despite my best efforts.

A perfect solution would be an open source demo I can read, grok, and adapt to my purposes.  The next best would be a patient explanation to my questions, like "what did I do wrong?" and "how do I fix it?"

Please, can you help?

Thank you!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: jogl + swing help, please.

imakerobots
Bump.

Today's my birthday.  Since my last post I've made no progress.  I have no idea how to proceed.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: jogl + swing help, please.

jmaasing
Happy birthday :)

To have a better chance of getting help:
Make a very small test program that shows the behaviour (http://sscce.org/)
Inform on what version of java, operating system et c.

I have never used Swing + jogl so I have no idea if what you describe is expected, usual, unusual et c.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: jogl + swing help, please.

gouessej
Administrator
In reply to this post by imakerobots
Hi

Please replace the GLCanvas by a GLJPanel in Arm3.java and let me know whether it works better.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: jogl + swing help, please.

imakerobots
gouessej - GLJpanel works a bit better in Arm3.java.  
If I call updateMenu() after a button click the menus vanish until I resize the window.  
If I don't call updateMenu() said menus might be out of date but at least they're visible and clickable.
Calling mainMenu.repaint() and mainMenu.invalidate() at the end of updateMenu() didn't help.

jmaasing - I will release the test case ASAP.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: jogl + swing help, please.

imakerobots
This post was updated on .
Update!

I added a JSplitPane to Arm3.  Everything resizes correctly and the swing components on the right appear to work.  Looks like your suggestion to use GLJPanel was the ticket.  Yay!

The menu is fixed and updates correctly.  I  forgot JMenu.updateUI().  Also Yay!

When a popup dialog appears I stop receiving keyboard events.  I still have my mouse events.  I see in http://www.java-gaming.org/index.php/topic,6173. they recommend using a keylistener on the parent frame instead of keyadapter on the glwindow.  I tried this method and found that it never regains focus.  Then I found http://stackoverflow.com/questions/5150964/java-keylistener-does-not-listen-after-regaining-focus and the fix there seems to work.  Haven't tested text inputs in the right hand side yet, I imagine they'll type and cause events in the gl window at the same time.  Mostly Yay?

When I go to export my project, is there a way to get the native jars to be included into the main jar?  I tried "package required libraries into generated JAR" but it didn't.  For now I've copied them into the same folder as the executable jar.  Feels messy and prone to breakage.  What did I miss?

Thank you all!  I feel like I've been stuck on this for ages and in a few quick messages you solved my dilemma.  Kudos, thank you, gracias... this is a big huge win.  Thank you.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: jogl + swing help, please.

gouessej
Administrator
Hi

We often talked about packaging and fat JARs on this forum, you can use our (Harvey and me) Ant scripts:
http://forum.jogamp.org/Fat-jar-deployment-method-ant-recipe-tp4032213.html

As your project is under GPL, you can use JNDT. I should update its instructions.

You can probably solve your problem in your IDE but it is a lot less flexible and less transparent than using Ant.
Julien Gouesse | Personal blog | Website
Loading...