Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7081857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:58:26+00:00 2026-05-28T06:58:26+00:00

I am combining Swing and Java3D together. Manipulations of swing components should be done

  • 0

I am combining Swing and Java3D together. Manipulations of swing components should be done using the Event Dispatcher Thread, while manipulations of Java3D components should be done in the BehaviourSchedulerThread.

Java3D renders the scene and then executes all of the behavior associated to the scene.

I have a MouseListener enabled on the Canvas3D. Events are posted into the AWT Event queue. I then want to modify the Java3D environment based on these events, so I use a special Behavior where I can post Runnable’s to. This makes sure the Runnable’s are executed during the Behavior cycle of Java3D (and do not modify anyting during the Render cycle).

Suppose some operations in the Behavior want to modify the Swing model. I then have to post a new Runnable to the EDT.

Is this the correct way to do it?

Using this technique, I experience a lot of problems on a mouse listener. I update a point in my Java3D model in the behaviour, and I update the swing GUI at the same time.

Update:
The problem can be more clearly defined as follows:

I have a JButton “spin cube” which has an ActionListener. Once the ActionListener is fired, it pushes the AWTEvent into a Java3D Behavior. Once the Behavior fires, it modifies the Scene graph and then modifies the JButton actionListener and text to become “Stop spinning”.

  1. Click on the JButton twice.
  2. The first AWTEvent gets dispatched to SpinActionListener. The cube starts spinning and the JButton actionListener is modified to StopSpinningActionListener.
  3. The second AWTEvent gets dispatched to StopSpinningActionListener. The cube stops spinning and the JButton actionListener is modified to SpinActionListener.

What actually happens is the following:

  1. Click on a JButton twice. Both AWTEvents get dispatched to SpinActionListener. This creates a Runnable to execute inside the J3D Behavior.
  2. The first AWTEvent starts a timer to spin the cube. It then posts a Runnable to the EDT to modify the button.
  3. The second AWTEvent starts a timer to spin the cube. The cube will now spin twice as fast. It then posts a Runnable to the EDT to modify the button.

Obviously, I should not be depending on AWTEvent’s getting processed sequentially. I cannot wait in the EDT for the behavior to fire, because any SwingUtilities.invokeAndWait() will then cause a deadlock.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T06:58:26+00:00Added an answer on May 28, 2026 at 6:58 am

    Which WakeupCriterion is used to wake-up your special Behavior object?

    Java 3D’s source code includes the utility classes

    com.sun.j3d.utils.behaviors.mouse.MouseBehavior/MouseRotate 
    

    which listens to Canvas3D’s AWTEvents. One of two alternatives can be chosen:

    1. MouseListener with WakeupOnBehaviorPost or
    2. WakeupOnAWTEvent.

    This code sample might be helpful.

    Initiating a Swing component update from within the Behavior.processStimulus method via SwingUtilities.invokeLater shouldn’t cause any problems.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm combining Tablesorter's ' disable headers using options ' function and the ' trigger
I'm combining multiple js files using YUI Compressor. The command works successfully and outputs
I am having code for combining two image and show them together in a
Possible Duplicate: Combining several database table together? I want from two database table get
It is explained here how combining java & xml configuration is done. It works.
I'm using LinqKit library which allows combining expressions on the fly. This is a
I'm combining jquery validate() with the jquery form plugin to submit a form using
Does combining an Enterprise Messaging solution with Web Services result in a real performance
Any tips on combining multiple .js files into 1 (for a build process). Will
I've just started combining my knowledge of C++ classes and dynamic arrays. I was

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.