public void pause(int pauseType) {
        switch (controlPanel.runType) {
            case 1: // run without stop
                break;
            
            case 2: // pause between instructions
                if (isRunning) {

                    switch (pauseType) {
                        case 0:
                            break;
                        case 1:
                            break;
                        case 2:

                            isRunning = false;
                            this.suspend();     // Suspend instructionThread
                                        
                            while(!isRunning) {  //  wait until the work in main thread
                                try {
                                    Thread.sleep(10);
                                } catch (InterruptedException ex) {
                                    Logger.getLogger(ControlPanel.class.getName()).log(Level.SEVERE, null, ex);
                                }
                            }
                            break;
                        default:
                            break;
                    }
                }
                else {
                    getControlPanel().jMessages.append("Error: Cannot pause!\nThread is already stopped\n");
                }
                break;
            
            case 3: // pause between micro steps
                if (isRunning) {

                    switch (pauseType) {
                        case 0:
                            break;
                        case 1:
                            isRunning = false;
                            this.suspend();     // Suspend instructionThread
                            while(!isRunning) {  //  wait until the work in main thread
                                try {
                                    Thread.sleep(10);
                                } catch (InterruptedException ex) {
                                    Logger.getLogger(ControlPanel.class.getName()).log(Level.SEVERE, null, ex);
                                }
                            }
                            break;
                        case 2:
                            isRunning = false;
                            this.suspend();     // Suspend instructionThread
                            while(!isRunning) {  //  wait until the work in main thread
                                try {
                                    Thread.sleep(10);
                                } catch (InterruptedException ex) {
                                    Logger.getLogger(ControlPanel.class.getName()).log(Level.SEVERE, null, ex);
                                }
                            }
                            break;
                        default:
                            break;
                    }
                }
                else {
                    getControlPanel().jMessages.append("Error: Cannot pause!\nThread is already stopped\n");
                }
                break;
            
            case 4: // pause for some time
                if (isRunning) {
                    switch (pauseType) {
                        case 0:
                            isSleep = true;
                            try {
                                Thread.sleep(1200);     // wait for some time at the end of instructions
                            } catch (InterruptedException ex) {
                                Logger.getLogger(PipelinedInstruction.class.getName()).log(Level.SEVERE, null, ex);
                            }
                            isSleep = false;
                            break;
                        case 1:
                            break;
                        case 2:
                            break;
                        default:
                            break;
                    }
                }
                else {
                    getControlPanel().jMessages.append("Error: Cannot pause!\nThread is already stopped\n");
                }
                break;
                
            case 5: // single Instructions mode
                if (isRunning) {

                    switch (pauseType) {
                        case 0:
                            break;
                        case 1:
                            //getControlPanel().jMessages.append("Status: \""+strSwitches+"\" is running!\n Click \"Run Single Step\" to continue!\n");
                            ControlPanel.btnSingleStep.setText("Click again to continue...");
                            isRunning = false;
                            this.suspend();     // Suspend instructionThread
                            while(!isRunning) {  //  wait until the work in main thread
                                try {
                                    Thread.sleep(10);
                                } catch (InterruptedException ex) {
                                    Logger.getLogger(ControlPanel.class.getName()).log(Level.SEVERE, null, ex);
                                }
                            }
                            break;
                        case 2:
                            isRunning = false;
                            ControlPanel.btnSingleStep.setText("Run Single Instruction (Step by Step)");
                            this.suspend();     // Suspend instructionThread
                            while(!isRunning) {  //  wait until the work in main thread
                                try {
                                    Thread.sleep(10);
                                } catch (InterruptedException ex) {
                                    Logger.getLogger(ControlPanel.class.getName()).log(Level.SEVERE, null, ex);
                                }
                            }
                            break;
                        default:
                            break;
                    }
                }
                else {
                    getControlPanel().jMessages.append("Error: Cannot pause!\nThread is already stopped\n");
                }
                break;
                    
            default:
                break;
        }
        
    }