| View previous topic :: View next topic |
| Author |
Message |
Andrew Mallinson Guest
|
Posted: Sat Nov 22, 2003 12:41 am Post subject: Prioritising the user interface |
|
|
Hi
Ive currently set my program up with a simple JFrame interface and a couple
of JMenus and JMenuItems. Just enough to allow me to read in some files and
start the program running.
The program starts about 50+ threads running in the background. Before the
threads are set running the interface works fine, however whilst the threads
are running it becomes a lot less responsive (i guess due to the extra
processing power the threads require).
Is there a way to maybe prioritise the user interface (i guess this runs on
a thread as well) so that it is given more of the processing power (time)
and can therefore respond better when i click the mouse on one of the menu
options.
Many thanks in advance for your help
Regards
Andy
|
|
| Back to top |
|
 |
Harald Hein Guest
|
Posted: Sat Nov 22, 2003 8:03 am Post subject: Re: Prioritising the user interface |
|
|
"Andrew Mallinson" wrote:
| Quote: | Is there a way to maybe prioritise the user interface (i guess
this runs on a thread as well) so that it is given more of the
processing power (time) and can therefore respond better when i
click the mouse on one of the menu options.
|
You can give threads a different priority, read the API docs ... BUT
this is just a suggestion. JVMs are allowed to ignore it. I would
suggest you start less threads, (queue the tasks), and do less updates
to the GUI.
|
|
| Back to top |
|
 |
Stephan Friedrichs Guest
|
Posted: Sat Nov 22, 2003 3:47 pm Post subject: Re: Prioritising the user interface |
|
|
Andrew Mallinson wrote:
| Quote: | Hi
[...]
Is there a way to maybe prioritise the user interface (i guess this runs on
a thread as well) so that it is given more of the processing power (time)
and can therefore respond better when i click the mouse on one of the menu
options.
|
SwingUtilities.invokeLater(new Runnable() {
public void run() {
Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
}
});
If this is not the usual setting...
| Quote: |
Many thanks in advance for your help
Regards
Andy
|
Hope this helps - Stephan
--
Spam protection: If an email response to this posting
is necessary, please respond to:
SFriedrichs [at] t-online [dot] de
--
http://home.t-online.de/home/sfriedrichs/
JAddressBook: 1.1
|
|
| Back to top |
|
 |
|