Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / November 2003

Tip: Looking for answers? Try searching our database.

Prioritising the user interface

Thread view: 
Andrew Mallinson - 22 Nov 2003 00:41 GMT
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
Harald Hein - 22 Nov 2003 08:03 GMT
> 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.
Stephan Friedrichs - 22 Nov 2003 15:47 GMT
> Hi
>
[quoted text clipped - 4 lines]
> 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...

> Many thanks in advance for your help
> Regards
> Andy

Hope this helps - Stephan

Signature

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



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.