• Post Reply Bookmark Topic Watch Topic
  • New Topic

Screen Flicker in Swing

 
Joseph Dobrzanski
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to update 6 text fields at a 10Hz rate using only swing objects. I have double buffering turned on for all objects but I am still experiencing unacceptable flicker. Anyone have any ideas?
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How many textfields? And Why do you need to update all the textfields every 10th of a second? A better way to update text fields based on data would be change only the textfields you *need* to cahnge when their background value changes... you can do this using listeners or custom Documents for your textfields...

A lot may depend on the speed of your computer ( how fast it can *really* redraw )and possibly your video card and graphics settings (More pixels = more to redraw) also... Actual redraw is also controlled by a background thread in Java... things like the lowest possible refresh rate and the granularity of the changes are hidden from you... so you may be trying to refresh 10 times a second, but the lowest rate may be 30... or granularity may be 15 milliseconds instead of 10... you'll have to do a bit of testing using System.currentTimeMillis() to find out if your program is *really* refreshing when and as often as you think it is.
 
Joseph Dobrzanski
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This project has a requirement for 10Hz updates. There are 6 text fields displaying some antenna pointing angles and other real time data that must be displayed very quickly. The GUI will also consist of 2 analog dials. I have run some tests and the text fields appear to be updating correctly (i.e. 10X/sec), but the flicker is unacceptable. I have tested this GUI on a Sun Blade 100 and a 1.4 GHz Pentium with a GeForce III video card. The Sun was mostly acceptable but the Pentium was awful.
I am a C++ embedded guy for the most part, so any tips you have are very much appreciated. I'm starting to worry that Java is not going to be adequate for this project.
In addition, do you know anything about Java for DOS or any other flavors of embedded Java?
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmm... even if the application as a whole needs to be able to react at a granularity of 10 x per second, I don't think that should mean that the gui should repaint itself at 10 Hz... It would make more sense for whatever code was listening for changes in the real-time stuff query 10 x per second, and only update the GUI if a change has occurred. Then only the fields that need updating would update, and you wouldn't have to worry about needless updates.

I haven't worked any with embedded Java... there is a forum on here about Java 2 Micro Edition, but I'm not sure if it's the same thing...
 
Joseph Dobrzanski
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you are right. I will try and use listeners instead. I appreciate your time and help!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!