Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8544487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:34:13+00:00 2026-06-11T12:34:13+00:00

I am trying to change the cursor when I start a operation. I want

  • 0

I am trying to change the cursor when I start a operation. I want the cursor showing busy until the operation is finished. I have a separate class for the operationListener.
I am not sure how to assign the cursor?

Call from AplotBaseDialog class

listOp.addOperationListener(new MyOperationListener(this) {
    etc....
} 

Separate Class

 public abstract class MyOperationListener implements InterfaceAIFOperationListener {
   Cursor busyCursor = null;
   AplotBaseDialog w = null;

  public MyOperationListener(AplotBaseDialog win) {

  **Should this not be getCurrent?**
    busyCursor = new Cursor(Display.getCurrent(), SWT.CURSOR_WAIT);

    w = win;
  } // end constructor

  public void startOperation(String startMessage) {
     ** should this be getting a Shell form the AplotBaseDialog? **
     w.???.setCursor(busyCursor);

  } // end startOperation()

  public void endOperation() {
     try {
        endOperationImpl();
     }
     finally {
        w.???.setCursor(null);
     }
  } // end endOperation()

  abstract protected void endOperationImpl();
 } // end class MyOperationListener

EDIT

  plotButton.addSelectionListener(new SelectionAdapter() {
         public void widgetSelected(SelectionEvent e) {
            BusyIndicator.showWhile(Display.getDefault(), new Runnable(){
               public void run(){
                  startPrinterListOperation(); 
               }
             });
         }
   });  

EDIT

 private void startPrinterListOperation() {

  listOp = new AplotPrinterListOperation(appReg.getString("aplot.message.GETPRINTERLIST"), session);
  listOp.addOperationListener(new MyOperationListener(this) {
     public void endOperationImpl() {
        try {
           printers.clear();
           printers.addAll((ArrayList<PrinterProfile>) listOp.getPrinters());
           Display.getDefault().asyncExec(new Runnable() {
              public void run() {

                 showAplotPlotterDialog();
              }
           });
        }
        finally {

           listOp.removeOperationListener(this);
           listOp = null;
        }
     }
  });
  session.queueOperation(listOp);


 } // end startPrinterListOperation()
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T12:34:15+00:00Added an answer on June 11, 2026 at 12:34 pm

    This works for me:

    private static boolean wait = false;
    
    private static Cursor cursor = null;
    
    public static void main(String[] args) {
        final Display display = new Display();
        final Shell shell = new Shell(display);
        shell.setLayout(new FillLayout());
    
        Button button = new Button(shell, SWT.PUSH);
        button.setText("Change cursor");
    
        button.addListener(SWT.Selection, new Listener() {
    
            @Override
            public void handleEvent(Event arg0) {
                wait = !wait;
    
                if(cursor != null)
                    cursor.dispose();
    
                cursor = wait ? new Cursor(display, SWT.CURSOR_WAIT) : new Cursor(display, SWT.CURSOR_ARROW);
    
                shell.setCursor(cursor);
            }
        });
    
    
        shell.setSize(200,200);
        shell.open();
        while (!shell.isDisposed()) {
            if (!display.readAndDispatch()) {
                display.sleep();
            }
        }
        display.dispose();
    
        if(cursor != null)
            cursor.dispose();
    }
    

    Just set the cursor of your containing shell via setCursor(Display, int).

    If you don’t want to change the cursor for the whole shell, use a Composite or Control of your choice.


    Remember that you have to dispose() each Cursor instance you create yourself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to change the cursor style to look like a pointer
I am trying to change cursor of a button in MFC dialog. i have
I'm trying to change the cursor inside my CStatic -derived class by handling OnSetCursor
I changed image of cursor. I am trying to change size of cursor image
so i have been trying to style a scrollviewer, so that i can change
I'm trying to apply cursor to my app, however, the document is not clear
I'm trying to change DatePicker's HTML markup in Apache Wicket. What I have for
i have pagination links like 1,2,3,4...am trying to change appearance of current page using
I'm trying to change a spoiler but i have problem with javascript code This
I'm trying to change the cursor that appears on a standard ListView when the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.