Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (535)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Swing Frame Rate / Custom RepaintManager  (Read 2214 times)
0 Members and 1 Guest are viewing this topic.
Offline pcabot

Junior Newbie




-


« Posted 2003-07-23 14:02:02 »

Hi,

I am writing a visual 2d equipment simulator using jdk1.3.1 under windows 2000.

I use Swing and AWT as renderer because I take advantage of the Design Time builder (bean box) to allow a fast and easy construction of simulations.

The simulations are mainly composed of reusable objects. The base class for all objects is a custom panel (JPanel) on which Images can be drawn.

Here are my questions :

1) When there are a lot of animation on screen (lets say many led objects that flashes), the memory usage of the simulation grows very fast.
I have pin pointed the problem with a Profiler (OptimizeIT) and I have discovered that the paintChildren() method of JComponent creates a lot of RECTANGLE objects to calculate the cliping area.
Is there a way to control that ?

2)  I have tried to create my own RepaintManager by subclassing the RepaintManager class. I have managed to catch all repaint() calls in the application, and force a repaint on the main application frame every 50ms using a timer, to simulate a fix frame rate. This seems to have free some of the CPU because the EventDispatcher is not longer flooded with repaint() request from all the objects. Is there anything else we can do with a Custom RepaintManager ?

3) One of the main item I have also discovered is that I am drawing all my components in a panel where cousins (siblings) components can lie on different layer on the same panel (i.e. components are added using the .add(c, 3) where 3 is a layer in JPanel).
This has a huge effect on performance since the JPanel Swing OptimizedDrawing feature (isOptimizedDrawing flag) must be set to false for the siblings components to be painted correctly. The result is that each time Swing wants to repaint a component, it must calculate the clipping area from the bottom of the hierarchy (frame) to the top (leaf component).
Is there a way to optimize the drawing without forcing swing to redraw the entire object tree ?

Any comments would be appreciated,

Thanks,

Philippe
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

pw (37 views)
2014-07-24 01:59:36

Riven (38 views)
2014-07-23 21:16:32

Riven (26 views)
2014-07-23 21:07:15

Riven (28 views)
2014-07-23 20:56:16

ctomni231 (59 views)
2014-07-18 06:55:21

Zero Volt (50 views)
2014-07-17 23:47:54

danieldean (42 views)
2014-07-17 23:41:23

MustardPeter (44 views)
2014-07-16 23:30:00

Cero (60 views)
2014-07-16 00:42:17

Riven (57 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!