Hello.
I am using a Swing worker to scan various tables during a can of a DB.
While it is working the progress bar encompasses a busy icon.
My question is how can I make the pointer take on that icon while a system scan is in progress?
While the scan is in progress it would be good to somehow alter the mouse pointer to in effect not allow the app to step on the scan.

Example: Swing worker Listener

worker = new ScanBookingWorker(processRecords, tableName, action);
        worker.addPropertyChangeListener(new PropertyChangeListener() {

            public void propertyChange(PropertyChangeEvent evt) {
                String propertyName = evt.getPropertyName();


                progressBar.setIndeterminate(true);
                busyIconTimer.start();
                if (SwingWorker.StateValue.DONE == evt.getNewValue()) {

                    busyIconTimer.stop();
                    statusMessageLabel.setText("Record Processing Complete");
                    statusAnimationLabel.setIcon(idleIcon);
                    progressBar.setIndeterminate(false);
                    progressBar.setValue(100);
                        ScanBookingFormController.clear();

                    view.MusicSystems.bottomBorder.remove(view.MusicSystems.statusComponentPanel);
                    MusicSystems.validateAndRepaint();





                } else if (SwingWorker.StateValue.STARTED == evt.getNewValue()) {

                    statusMessageLabel.setText("Processing Records");
                    progressBar.setVisible(true);

                    if (!busyIconTimer.isRunning()) {
                            statusAnimationLabel.setIcon(busyIcons[0]);


                            busyIconIndex = 0;
                            busyIconTimer.start();
                    }




                } else if (SwingWorker.StateValue.PENDING == evt.getNewValue()) {

                    progressBar.setVisible(true);
                    progressBar.setIndeterminate(false);
                    //progressBar.setValue(100);

                } else if ("progress".equals(propertyName)) {
                    //System.out.println(C + AND + propertyName + ":  } else if (progress.equals(propertyName)) {: \n");
                    //BottomComponents.triggerLbl.setText(SerializeFrame.element+" "+SerializeFrame.count);
                    int value = (Integer) (evt.getNewValue());
                    progressBar.setVisible(true);
                    progressBar.setIndeterminate(false);
                    progressBar.setValue(value);
                }
            }
        });




        // this event thread continues immediately here without blocking


        worker.execute();


    }

init_() //to iniate the busy icon for the workers

public static void init_() throws IOException, FileNotFoundException, SQLException, {



    if (statusMessageLabel != null) {
        MusicSystems.bottomBorder.remove(MusicSystems.statusComponentPanel);

    }
    triggerLbl = new JLabel();
    statusMessageLabel = new JLabel();
    progressBar = new JProgressBar();

    triggerLbl.addPropertyChangeListener(new PropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent e) {



        }
    });

    //status bar initialization - message timeout, idle icon and busy animation, etc

    int messageTimeout = ViewUtils.getInteger("StatusBar.messageTimeout");
    messageTimer = new Timer(messageTimeout, new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            statusMessageLabel.setText(" ");
        }
    });
    messageTimer.setRepeats(false);
    int busyAnimationRate = ViewUtils.getInteger("StatusBar.busyAnimationRate");
    for (int i = 0; i < busyIcons.length; i++) {
        busyIcons[i] = ViewUtils.getIcon("StatusBar.busyIcons[" + i + "]");
    }
    busyIconTimer = new Timer(busyAnimationRate, new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            busyIconIndex = (busyIconIndex + 1) % busyIcons.length;
            statusAnimationLabel.setIcon(busyIcons[busyIconIndex]);
        }
    });
    idleIcon = ViewUtils.getIcon("StatusBar.idleIcon");
    statusAnimationLabel = new JLabel();
    int iconWidth = idleIcon.getIconWidth();
    int iconHeight = idleIcon.getIconHeight();
    statusAnimationLabel.setSize(iconWidth, iconHeight);
    statusAnimationLabel.setIcon(idleIcon);
    busyIconTimer.start();


}

Here is another post on the same subject.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.