Lengthy process in Netbeans - Sample plugin
In my previous blog Preventing user interaction during lengthy operation in netbeans, I gave a tip on how to use Window.glassPane to prevent the user interaction during lengthy process. Geertjan has requested if I could provide a plug-in, as a context for my tip. So I wrote this small plugin as a sample. You can download the NBM from here. This plugin adds a menu item called "A simple lengthy process" to the Tools menu. This menu item fires a process to calculate some prime numbers. The process takes about 15-20 secs to finish. During that time the user is prevented from interacting with the IDE.
When I was creating the module, I noticed that user could still interact with the UI even after I made the glasspane visible. So I had to do a small trick by adding the following line of code for the glasspane to grab the mouse focus.
mainWin.getGlassPane().addMouseListener( new MouseAdapter() {});
Also I've added the progress indicator at the status bar as shown in the picture below. Adding the progress bar is very easy. All you need to do is to use the Progress API. The code snippet I used is very simple
ProgressHandle handle = ProgressHandleFactory.createHandle("Prime number calculator");
handle.start(100);
int progressValue = <calculated value>;
...
handle.progress(progressValue );
Posted at 11:11PM Feb 12, 2006 | Permanent link to this entry
Posted by Geertjan on March 31, 2006 at 08:02 AM PST #
Posted by 3P on May 15, 2006 at 09:38 PM PDT #
Posted by 192.18.43.249 on June 16, 2006 at 07:06 AM PDT #
Posted by Mayank Patel on October 18, 2006 at 04:32 AM PDT #
Posted by Mayank Patel on October 18, 2006 at 04:34 AM PDT #
http://www.batteryfast.co.uk/samsung/q25.htm samsung q25 battery,
http://www.batteryfast.co.uk/samsung/np-x1.htm samsung np-x1 battery,
http://www.batteryfast.co.uk/sony/pcga-bp1n.htm sony pcga-bp1n battery,
Posted by laptop batteries on October 24, 2008 at 12:00 AM PDT #