How 2 use Progress Monitor.. when u dont know hw long process takes place!

hello frnds,
I am trying to use ProgressMonitor.. to show user that required process is taking place.. so wait for a while!!
what before i was doing is to miimize the frame for that time and popping it again.. :-).. was really silly of me..
setExtendedState(JFrame.ICONIFIED);
NewProject();                      // This function takes time..
setExtendedState(JFrame.NORMAL);I was wondering that cant I use progressmonitor for that time.. but I dont know how long that function runs.. so may be now I have to use separate thread for it..
well even word THREAD haunts me.. so much.. .. never tried in my code.. If you people helps me how to put thread.. in my code..
so that I can show dialog ProgressMonitor for that time.. I would be grateful.. even i dont know whther thread is really necessary for what am trying to do.. !!
Thanking in advance!!
gervini

see if this makes any sense
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class Testing extends JFrame
  ProgressMonitor pmon = null;
  public Testing()
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    setSize(200,100);
    setLocation(200,100);
    JPanel panel = new JPanel();
    JButton btn = new JButton("Run");
    btn.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent ae){
        pmon = new ProgressMonitor(null, "","",0, 100);
        new Thread(new LongTask(pmon)).start();}});
    panel.add(btn);
    getContentPane().add(panel);
public static void main(String[] args){new Testing().setVisible(true);}
class LongTask implements Runnable
  int percentDone = 0;
  ProgressMonitor pm;
  public LongTask(ProgressMonitor p){pm = p;}
  public void run()
    someMethod();
  public void someMethod()
    for(int x = 0; x < 100000000; x++)
      if(x % 1000000 == 0)
        percentDone++;
        pm.setProgress(percentDone);
        pm.setNote("Task is " + percentDone + "% complete");
        //try{Thread.sleep(200);}catch(InterruptedException ie){}//may need this on a fast pc
      if (pm.isCanceled()) return;
}

Similar Messages

  • How to change passcode when you dont know it

    Hi there i have changed my passcode but you know when you use fingerprint recognition at all times and than you battery died on you when you started up you have to put passcode in and that is where my problem began. Can somebody tell me how to reset passcode  plz.

    Locked Out, Forgot Lock or Restrictions Passcode, or Need to Restore Your Device: Several Alternative Solutions
    A
    1. iOS- Forgotten passcode or device disabled after entering wrong passcode
    2. iPhone, iPad, iPod touch: Wrong passcode results in red disabled screen
    3. Restoring iPod touch after forgotten passcode
    4. What to Do If You've Forgotten Your iPhone's Passcode
    5. iOS- Understanding passcodes
    6. iTunes 10 for Mac- Update and restore software on iPod, iPhone, or iPad
    7. iOS - Unable to update or restore
    Forgotten Restrictions Passcode Help
                iPad,iPod,iPod Touch Recovery Mode
    You will need to restore your device as New to remove a Restrictions passcode. Go through the normal process to restore your device, but when you see the options to restore as New or from a backup, be sure to choose New.
    You can restore from a backup if you have one from BEFORE you set the restrictions passcode.
    Also, see iTunes- Restoring iOS software.

  • How to use  Progress Monitors?

    how to use Progress Monitors?
    in the name of god
    hi friends
    i have a problem. I am writing a program that read data from a file record by record and store to a database. my problem is here that i want add a progress monitor that when the program is doing its work it appear. I use ProgressMonitorInputStream class but it can not work well. It appear and read file record by record and store in table of database but its progress don’t move and do nothing. I know that I have a tiny problem in use this class. Please guide me.
    i put my codes below.
    best regards
    *////this is an event that invoke my classes*
    private void readbtnActionPerformed(java.awt.event.ActionEvent evt) {                                       
            JFileChooser fileChooser = new JFileChooser();
            fileChooser.setCurrentDirectory(fileName);
            //filtering file extension
            FileNameExtensionFilter filter = new FileNameExtensionFilter("Text file", "txt");
            fileChooser.setFileFilter(filter);
            //fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
            int result = fileChooser.showOpenDialog(this);
            if (result == JFileChooser.APPROVE_OPTION) {   //if choose ok button
                fileName = fileChooser.getSelectedFile();
                ReadTextFile readFile = new ReadTextFile(fileName);
                readFile.openFile();
                readFile.readRecord();
                *//readFile.closeFile();       //if  this line enable this message appeare "Scanner closed" .why?*      
                readFile.closeFile();
            } else //if choose cancel button
                result = 0;     //do nothing
    */////this is readFile class and invoke data access class and insert data in my database*
    public class ReadTextFile {
        private Scanner input;
        private File fileName;
        private int i = 1;
        DataAccess dal = new DataAccess();                     //new a defined my class
        AcountRecord record = new AcountRecord();
        public ReadTextFile(File n) {       //Constructor
            fileName = new File(String.valueOf(n));
            this.openFile();
        private void setRecord(String val) {
            try {
                record.setId(Integer.parseInt(val.substring(1, 5)));
                record.setTime(Integer.parseInt(val.substring(8, 12)));
                record.setDate(Integer.parseInt(val.substring(15, 21)));
                record.setMode(val.substring(24, 26));
            } catch (Exception e) {
                JOptionPane.showMessageDialog(null, "ÇäÊÎÇÈ ÔãÇ äÇÏÑÓÊ ÇÓÊ.","Set Record Method",JOptionPane.ERROR_MESSAGE);
        public void openFile() {
            try {
                input = new Scanner(fileName);
            } catch (FileNotFoundException e) {
                JOptionPane.showMessageDialog(null, "ÇäÊÎÇÈ ÔãÇ äÇÏÑÓÊ ÇÓÊ.","Open File Method",JOptionPane.ERROR_MESSAGE);
        public void readRecord() {
            new Thread() {
                private Component _Main;
                @Override
                public void run() {
                    try {
                        input = new Scanner(fileName);
                        InputStream in = new FileInputStream(fileName);
                        ProgressMonitorInputStream pm =
                                new ProgressMonitorInputStream(_Main, "reading the file", in);
                        ProgressMonitor pmo = pm.getProgressMonitor( );
                        pmo.setMaximum( (int) fileName.length());
                        while (/*input.hasNext() &&*/ pm.read() != -1) {
                            setRecord(input.next());
                            dal.Connect();
                            String sql = "INSERT INTO fileinfo(pkey,id,date,time,mode)VALUES(%s,%s,%s,%s,'%s')";
                            sql = String.format(sql, i++, record.getId(), record.getDate(), record.getTime(), record.getMode());
                            dal.doCommand(sql);
                    } catch (Exception e) {
                        JOptionPane.showMessageDialog(null, e.getMessage() ," Read Record method.",JOptionPane.ERROR_MESSAGE);
                    dal.Disconnect();      
            }.start();
        public void closeFile() {
            input.close();
    }Edited by: firethumbs on Mar 26, 2009 12:43 PM

    IN THE NAME OF GOD
    hi firends
    i forget say one thing. if remove while loop content this program will work good. i suppose that the while condition and read file records not similar. because while condition check bytes but in while body read records. is that true?
    how can solve this problem?
    best regurds

  • How do you unlock a phone when you dont know the password?

    how do you unlock a phone when you dont know the password?

    Connect in recovery mode and restore, you'll get the option to reset the passcode during this process:
    iOS: Unable to update or restore and iPhone and iPod touch: Wrong passcode results in red disabled screen
    If you cannot remember the passcode, you will need to restore your device using the computer with which you last synced it. This allows you to reset your passcode and resync the data from the device (or restore from a backup). If you restore on a different computer that was never synced with the device, you will be able to unlock the device for use and remove the passcode, but your data will not be present. Refer to Updating and restoring iPhone, iPad and iPod touch software.

  • I signed up yesterday with synch. I dont know my password and I need it to reset a new password. Please advise how to set a new password when I dont know old 1

    I signed up yesterday with synch. I don't know my password and I need it to reset a new password. Please advise how to set a new password when I dont know old 1
    I set it up on my "upstairs computer" and then came to my "downstairs computer" to synch and I can not get into the account because of the above password problem. I write down my passwords. I must have mistyped it or mis written.
    I want to change my password

    The new Sync version uses the Firefox account and stores the login data (username/email and password) under the https://accounts.firefox.com site heading in the Password Manager and use the signedInUser.json file in the profile folder to store the credentials once connected to the account to avoid having to enter the master password on each start.

  • I bought an ipod shuffle 2nd gen a few years ago. tried setting it up got bored and never tried again. really wat to use it now but i dont know how. any help would be greatly appreciated!!

    I bought an ipod shuffle 2nd gen a few years back. i did try to set it up at the time but found it hard (i was young and impatient!!) got bored and never tried again. I really would love to start using it now, but i dont know how....please help!!!

    Hello emmalemonjuice,
    Why not take a look and make use of your iPod's User Guide?
    http://manuals.info.apple.com/en_US/iPod_shuffle_Features_Guide.pdf
    B-rock

  • HT5625 how do we set up the i phone when we dont know the pass worrd and nether does the former owner

    how do we set up the i phone when we dont know the pass word and nether does the former owner?

    See if this helps:
    http://support.apple.com/kb/HT1212
    ... but if neither you nor the former owner knows the passcode, I believe you have a serious problem.  Are you sure you didn't just acquire a stolen iPhone?

  • How long does step 4 of 6 (transferring Purchases) take from an iphone? its been doing it for about 20-30 minutes now and hasn't progressed at all, i dont know if its crashed or anything, and im scared to unplug it... HELP

    how long does step 4 of 6 (transferring Purchases) take from an iphone? its been doing it for about 20-30 minutes now and hasn't progressed at all, i dont know if its crashed or anything, and im scared to unplug it... HELP

    how long does step 4 of 6 (transferring Purchases) take from an iphone? its been doing it for about 20-30 minutes now and hasn't progressed at all, i dont know if its crashed or anything, and im scared to unplug it... HELP

  • HT4293 i am trying to use dual monitors when editing with FCPX. I have a macbook pro and an apple cinema display monitor. I have connected them and opened Fcpx but the option to use second monitor is not active! what do i do ? please help going bonkers!

    i am trying to use dual monitors when editing with FCPX. I have a macbook pro and an apple cinema display monitor. I have connected them and opened Fcpx but the option to use second monitor is not active! what do i do ? please help going bonkers!

    <http://support.apple.com/kb/HT5891>
    You can use USB for the Apple trackpad.
    <http://www.mobeetechnology.com/the-power-bar.html>

  • I cant use my itunes because i dont know my secrity qusetions

    i cant use my itunes because i dont know my secrity qusetions

    If you have a rescue email address (which is not the same thing as an alternate email address) set up on your account then you can try going to https://appleid.apple.com/ and click 'Manage your Apple ID' on the right-hand side of that page and log into your account. Then click on 'Password and Security' on the left-hand side of that page and on the right-hand side you might see an option to send security question reset info to your rescue email address.
    If you don't have a rescue email address then see if the instructions on this user tip helps : https://discussions.apple.com/docs/DOC-4551

  • Where does the processing take place when using a remote front panel?

    Hi,
    I am considering upgrading my LabView software from 6i to 6.1 for the new "two click" remote front panel feature. I have already seen a demo of this feature but have just a few questions before I get the upgrade:
    My setup consists of several pieces of equipment connected to Labview via GPIB, to aid in the evaluation of a new microchip.
    1. I wish to grant control of the setup to anyone with a web browser, Is the remote monitoring feature compatible with both Netscape and IE?
    2. The VI which controls the setup is currently located on the PC beside my setup. When I embed a VI in a remote front panel, where does the processing take place, is the local VI still controlling the setup? and
    the remote panel just sending and receiving data from the local VI.
    Thanks, Troy

    > I am considering upgrading my LabView software from 6i to 6.1 for the
    > new "two click" remote front panel feature. I have already seen a demo
    > of this feature but have just a few questions before I get the
    > upgrade:
    >
    > My setup consists of several pieces of equipment connected to Labview
    > via GPIB, to aid in the evaluation of a new microchip.
    >
    > 1. I wish to grant control of the setup to anyone with a web browser,
    > Is the remote monitoring feature compatible with both Netscape and IE?
    >
    Yes. Provided they are resonably modern versions.
    > 2. The VI which controls the setup is currently located on the PC
    > beside my setup. When I embed a VI in a remote front panel, where does
    > the processing take place, is the local VI still controlling the
    >
    setup? and the remote panel just sending and receiving data from the
    > local VI.
    >
    The computer which we refer to as the server, the one with the GPIB card
    in your case, will execute as it does now. In fact, its window will
    even be open. The remote client computer, the one with the web browser
    will be running the runtime engine and processing user events, value
    change and property/method events from the server. So in reality, both
    computers will be sharing the load a bit. This allows for very small
    packets to be sent between the computers. It is in fact quite similar
    to publishing the data between the computers using datasocket.
    One thing to keep in mind. Standard LV includes a license for one
    connection. If you want to allow for multiple web browsers to view at
    the same time, additional licenses are available. Also, only one user,
    remote or server may be in control of the panel at a time. That means
    that if you want to be able to operate the panel, changing kn
    obs or
    flipping switches, the others will become viewers only until you give up
    control. Hopefully this isn't a surprise, but I thought you might want
    to hear about it now.
    Greg McKaskle

  • How to upload data using utl_file when you dont know the exact file name

    Hi
    i want to upload data from a flat file to a table.
    i dont know the exact file name. i want to make a search for filename. like i want to make a search on file (say test*) which will give me all the files with test.
    i want to upload data using these files.
    how can i do this by using UTL_FILE.
    Regards
    Manish

    Thank you very much.
    Thing is previously we are using sqlloader and shell script for loading the data.
    now i am creating a procedure (if possible without parameters).
    Is there any other way i can do that.
    can i make a wild card search using utl_file.
    Thanks n Regards
    Manish

  • How do you get rid of jwplayer on your computor when nyou dont know how it got on their because it wont let me play my programs and i an not buying it

    could you show me how to delight jwplayer on my computor I dont know how it was installed but it wont let me play my craig proctor vidios and i am not buying a programm when it worked 3 weeks age this player says error in player I dont remember doing a download to use it i would apprciate if you could help thank you Gary

    You can check for recently installed suspicious or unknown extensions.
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes
    Do a malware check with several malware scanning programs on the Windows computer.
    Please scan with all programs because each program detects different malware.
    All these programs have free versions.
    Make sure that you update each program to get the latest version of their databases before doing a scan.
    *Malwarebytes' Anti-Malware:<br>http://www.malwarebytes.org/mbam.php
    *AdwCleaner:<br>http://www.bleepingcomputer.com/download/adwcleaner/<br>http://www.softpedia.com/get/Antivirus/Removal-Tools/AdwCleaner.shtml
    *SuperAntispyware:<br>http://www.superantispyware.com/
    *Microsoft Safety Scanner:<br>http://www.microsoft.com/security/scanner/en-us/default.aspx
    *Windows Defender:<br>http://windows.microsoft.com/en-us/windows/using-defender
    *Spybot Search & Destroy:<br>http://www.safer-networking.org/en/index.html
    *Kasperky Free Security Scan:<br>http://www.kaspersky.com/security-scan
    You can also do a check for a rootkit infection with TDSSKiller.
    *Anti-rootkit utility TDSSKiller:<br>http://support.kaspersky.com/5350?el=88446
    See also:
    *"Spyware on Windows": http://kb.mozillazine.org/Popups_not_blocked
    *https://support.mozilla.org/kb/troubleshoot-firefox-issues-caused-malware

  • HT1430 how do i completely restart my ipod touch when i dont know my pass code?

    i forgot my passcode an dont know how to restart it .

    - You do not have to restore to factory defaults/new iPod if you forgot your screen-lock passcode. The screen-lock passcode is NOT restored if the backup contains a screen-lock passcode.
    - You also may have to place the iPod in Recovery mode to allow a restore.

  • How do i actvate my ipod when i dont know the previous onwers number or anything

    i cant activate my ipod because i dont know anything of the previous owener please help

    You are running into
    iCloud: Find My iPhone Activation Lock in iOS 7
    You either have to enter the ID and PW for the previous owner or get the previous owner to remove the device from their account
    Find My iPhone Activation Lock: Removing a device from a previous owner’s account
    Otherwise you have a thin brick flashlight
    I recoment that yo contact the police since maybe the iPod was stolen or lost

Maybe you are looking for