• Post Reply Bookmark Topic Watch Topic
  • New Topic

Gas molecule Simulation  RSS feed

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • 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: 56610
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We’d need a lot more details before we could give a useful answer.
 
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
thanks... I'll recheck the code!

 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!