• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Gas molecule Simulation

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everybody,
suppose that I want to simulate gas molecules in a closed space and their collision.
I use Swing.Timer and with 40Hz frequency I repaint JPanel with new data that was calculated by a function,but when I increase the number of molecules(more than 3!) It doesn't work properly.
Is it the best technique to do this?
 
Marshal
Posts: 76884
366
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We’d need a lot more details before we could give a useful answer.
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Moein Sol wrote:suppose that I want to simulate gas molecules in a closed space and their collision.
I use Swing.Timer and with 40Hz frequency I repaint JPanel with new data that was calculated by a function,but when I increase the number of molecules(more than 3!) It doesn't work properly.
Is it the best technique to do this?


I don't think so, but it has nothing to do with your choice of Timer or component; it has to do with your approach.

The simulator itself is the thing you need to concentrate on; and it should work whether you're displaying the results in Swing, on a webpage, or just with System.out.println().

Concentrate on that; and get that working. Then worry about how you display the results.

Winston
 
Moein Sol
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks... I'll recheck the code!

 
No matter. Try again. Fail again. Fail better. This time, do it with this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic