Changing cursor in dialog

Hello All.
I have the modal dialog with widget based on PictureWidget.
I need to change mouse cursor from Arrow to Hand when mouse is over the widget because user can drag the image content when the size of this image is bigger than size of the widget.
I tried set AcquireModalCursor and also tried to reimplement IID_ICURSORPROVIDER for my widget and for the whole dialog but nothing has changed - I always have base arrow as a dialog cursor.
My reimplemented method GetCursor is not launched for some reason.
Any help and advices will be very appreciated.
Sofia

Hi Rodney,
Pls. Ignore my previous reply.
Actually, calling dtde.rejectDrag() method will cancel the DnD operation, which I don't want to. I just want to change the cursor.
Thanks & Regards
Clefies R D'Souza

Similar Messages

  • How to change cursor when need to open a new dialog?

    Hi,
    I try to change cursor to WAIT when client open a new dialog, which it tell user the program was running to ready display new dialog.
    My code was like the following
    scene.setCursor(Cursor.WAIT);
    someclass.showMyDialog(); // The dialog was a new stage with StageStyle.UTILITY style
    scene.setCursor(Cursor.DEFAULT);
    But the cursor didn't be changed, I didn't know it why? Anybody know it? thank in advance!
    I had search the google, and didn't find the perfect answer, most of they was like to use setCursor(Cursor.WAIT) mode.
    the current ENV in my host was: windows 7 and Java
    java version "1.7.0_13"
    Java(TM) SE Runtime Environment (build 1.7.0_13-b20)
    Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)
    Best regards,
    Edited by: user13005878 on May 27, 2013 1:48 AM

    If you have a long running process ("long" means anything the user will notice), you need to run it in a thread other than the JavaFX Application Thread. In other words, you need to change the cursor to the wait cursor on the FX Application Thread, launch a user-defined thread for your long running process (connecting to the database), and once that thread is complete, show the dialog and change the cursor back on the FX Application Thread again. If you try to do everything on the FX Application Thread, you'll likely block that thread and prevent any changes from being visible to the user until the long process is complete (so you'll never see the wait cursor).
    All that said, and as jsmith said, there are some bugs in JavaFX 2.2 with the appearance of the cursor. So on my system (Mac OS X 10.7.5) the "correct" behavior is only observed with JavaFX 8.
    This is an example of doing things wrong. Here I don't see any change to the cursor, even on JavaFX 8:
    import javafx.application.Application;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.scene.Cursor;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.layout.BorderPane;
    import javafx.stage.Stage;
    public class WaitCursorDemo extends Application {
      @Override
      public void start(Stage primaryStage) {
        final BorderPane root = new BorderPane();
        final Scene scene = new Scene(root, 600, 400);
        Button button = new Button("Do something time-consuming");
        button.setOnAction(new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            System.out.println("Starting...");
            scene.setCursor(Cursor.WAIT);
            try {
              Thread.sleep(2000);
            } catch (InterruptedException exc) {
              exc.printStackTrace();
            scene.setCursor(Cursor.DEFAULT);
            System.out.println("Done");
        root.setBottom(button);
        primaryStage.setScene(scene);
        primaryStage.show();
      public static void main(String[] args) {
        launch(args);
    }This works on JavaFX 8: after pressing the button I see the wait cursor for two seconds, then it reverts to the default cursor.
    import javafx.application.Application;
    import javafx.concurrent.Task;
    import javafx.concurrent.WorkerStateEvent;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.scene.Cursor;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.layout.BorderPane;
    import javafx.stage.Stage;
    public class WaitCursorDemo extends Application {
      @Override
      public void start(Stage primaryStage) {
        final BorderPane root = new BorderPane();
        final Scene scene = new Scene(root, 600, 400);
        Button button = new Button("Do something time-consuming");
        button.setOnAction(new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            System.out.println("Starting...");
            scene.setCursor(Cursor.WAIT);
            Task<Void> task = new Task<Void>() {
              @Override
              protected Void call() throws Exception {
                try {
                  Thread.sleep(2000);
                } catch (InterruptedException exc) {
                  exc.printStackTrace();
                return null;
            task.setOnSucceeded(new EventHandler<WorkerStateEvent>() {
              @Override
              public void handle(WorkerStateEvent event) {
                scene.setCursor(Cursor.DEFAULT);
                System.out.println("Done");
                // Display your dialog now you have the data from the database...
            new Thread(task).start();
        root.setBottom(button);
        primaryStage.setScene(scene);
        primaryStage.show();
      public static void main(String[] args) {
        launch(args);
    }

  • Change font of dialog box

    I am using JOptionPane as dialog box for my application.
    Could anybody tell me how to change the font properties of JOptionPane?
    Thanks a lot.

    I've tried a lot of ways to change the font of the Labels and Buttons in JOptionPane.
    But I still can't change the Input Dialog.
    Here is the way that I change the fonts of buttons of JOptionPane:
    String message;//Message to display
    String title;//Title of the dialog
    Icon icon;//Icon to display
    JOptionPane op = new JOptionPane(msg,JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION, icon, new Object[] {"Yes", "No"}, "No");
    //panel1 is the panel that holds the buttons
    JPanel panel1 = (JPanel)op.getAccessibleContext().getAccessibleChild(1);
    //the panel that holds labels is op.getAccessibleContext().getAccessibleChild(0);
    //but labels can use embedded HTML, that's more easier than doing like this.
    //then get the components that you want to change.
    //get the first button
    JButton btnYes = (JButton)panel1.getAccessibleContext().getAccessibleChild(0);
    //get the second button
    JButton btnNo = (JButton)panel1.getAccessibleContext().getAccessibleChild(1);
    //then set the font, here I set them different to show that it does work!
    btnYes.setFont(new java.awt.Font("SansSerif", 0, 11));
    btnYes.setFont(new java.awt.Font("SansSerif", 0, 12));
    //then show the dialog...
    op.createDialog(null, title).setVisible(true);
    But it seems rather ugly...and I can't do this to the input dialog, because
    i don't know how to create a JOptionPane instance for input component(TextField
    or ComboBox), but just write JOptionPane.showInputDialog(....) as a default one.

  • Mission impossible:  changing icons in dialogs?

    Hi, Is it really impossible to change icons in dialogs in a straightforward manner? I am new to Java Swing but have used most GUI:s and really never encountered any problems changing icons in the caption part of a window frame (upper left corner). If such common practice is as hard as it seems in Java, it must be considered a major flaw! Please take a look at the problem and enlighten me.
    It is easy to replace the default �coffee cup� icon in the main application window (a JFrame) with a new icon in file "main.gif",
    Toolkit kit = Toolkit.getDefaultToolkit();
    Image icon = kit.getImage(�main.gif");
    setIconImage(icon);
    The following creates a non-modal dialog window (one the user mustn't close before doing something else),
    Dialog status = new JDialog(this,"Status",false);
    The dialog will have the main JFrame as its parent and inherit its icon. Fine, but I want some other icon in this dialog, for example a toolbar icon in file "status16.gif". The only way to do it seems to be to introduce a �dummy� Jframe like this,
    JFrame frame = new JFrame();
    Image icon = kit.getImage("status16.gif");
    frame.setIconImage(icon);
    Dialog status = new JDialog(frame,"Status",false);
    The dialog now sports the status icon, but there is a dire side-effect of this fix. The main JFrame will no longer be the parent of the dialog (the 'dummy' JFrame will) and this has consequences. For example when the user activates the application main window by clicking on it, the dialog window will no longer automatically place itself on top. A work-around would involve explicitly writing dialog window management code.
    It shouldn�t be this complicated to accomplish something as simple as an icons change. I must have missed something important here.
    Best Regards, Ulf Johansson

    DOMO, I too can't get the bug links to work. I suspect many have encountered my "icon in dialog"-problem but given up. It's a frustrating flaw. If nobody comes up with a soulution I'll file a bug report for what it's worth. Sun should take these 'minor' issues seriously. In C# it's a breeze.
    /Ulf Johansson

  • How to change 'cursor'

    Is there a way to change the 'cursor' so that it is always a 'hand' or something else that is easier to see - this is for one of the users that I support. They're looking for the cursor to always be this way, no matter what (ever, regardless). I have not been able to find this feature and other Adobe users I have talked to haven't found anything like it either.

    Hi, showing some messages when moving over a button can be done by standard-functionality useing property "tooltip-text" for the button.
    If you want your own bean start with overwriting the class oracle.forms.ui.VButton, use method with code similar to the following
      protected void processMouseEvent(MouseEvent p0)
        if ((p0.getID()==MouseEvent.MOUSE_ENTERED) && this.isEnabled())
          // Add your code for changing cursor here
          super.processMouseEvent(p0);
        } else if ((p0.getID()==MouseEvent.MOUSE_EXITED) && this.isEnabled())
          // Add your code for changing cursor here
          super.processMouseEvent(p0);
        } else
          super.processMouseEvent(p0);
      }hope this helps

  • Change cursor to hourglass

    i want to change cursor to hourglass when a new servlet is loading. working of my program is that on click of submit,the present servlet unloads and a new servlet is loaded.this new servlet takes time. so i can't write the code in prevoius servlet for cursor and the new servlet which is being loaded changes cursor to hourglass only after fully loading. please help me in this regard

    Write the javascript, flush the output stream, and the hourglass should be shown right away...
    note: You should write some stuff before the javascript -- send some text maybe the top of the output page. IE has some internal buffer you have to fill up before server-side flushing works.
    Again: You should make sure you send the javascript and flush before you start processing.
    Also: You will not be able to do a send redirect if you use this approach. If this is not satisfactory, you could try using one of the "Please Wait" mechanisms described on this site (use the forum or google search for JSP "Please Wait" to find them) to do the job.

  • Can I change cursor motion using tab key?

    Hi everyone,
    I'm Tae from Japan.
    Now, I'm developing UI with WD4J and I'd like to change cursor motion.
    for example:
    - left to right
    - up and down
    Environment:
    SAP NW CE 7.1
    SAP NWDS CE 7.1 SP05
    Thanks and BestRegards,
    Tae

    Hi Tae,
    Cursor motion through Tab is default given in WD Java, Cursor goes to next defined element in view. By designing the view layout properly you can manage the cursor movement as per requirement.
    some points :
    1) Tab moves the cursor to next item (if Label property "Labelfor" is  not defined for any ui element, it considers label as one element. Hence define labelfor property)
    2)you can use any of layouts grid, matrix, flow or row to define the ui elements.
    3)Tab will go to the next element in the same container. After completing all elements in one cotainer cursor goes to next container as defined in view.
    3)Shift+Tab will move the cursor backward.
    Regards
    Deepak

  • Changing cursor apperiance..How?

    I'm working on some school project and I have three frames. I need to change cursor apperiance while it's over those three internal frames. I know how to handle listeners, and all other stuff I need just I cann't find any way to setup cursor apperiance...I was looking in swing but nothing..or my docs are not good...

    All descendents of Component inherit setCursor. Use it as follows:
    component.setCursor(new Cursor(Cursor.WAIT_CURSOR));

  • WAd Report - How to change Cursor Type...

    Hi,
    In BI WAD report output, the cursor type is Pointer (Hand sign). I wanted to change it to some other type, is this possible, If yes, could u pls let how can i do that. I tried a lot but didn't suceed.
    Thanks...

    I think this would be possible by having custom CSS embedded in web template. E.g. see here:
    http://www.zimmertech.com/tutorials/css/20/changing-cursors-tutorial.php

  • How can I change cursor while it does something?

    hi, all
    following code dosen't change current cursor.
    I want to change cursor to wait_cursor while it opens file,
    but, it doesn't change cursor at all.
    What's problem?
    class aClass extends JFrame{
    btOpen.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent e){                
    int returnVal = jfcFileDialog.showOpenDialog(SourceEditor.this);
    if (returnVal == JFileChooser.APPROVE_OPTION) {
    openedFile = jfcFileDialog.getSelectedFile();
    setCursor( Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));      
    //read openedFile and return text
    String fileContent=readSourceFile();
    setCursor( Cursor.getPredefinedCursorCursor.DEFAULT_CURSOR));
    thank you.

    I finally figured it out. You have to set the cursor on the JFrame's GlassPane. The solution was alluded to in the Evaluation section of a couple of bug reports:
    http://developer.java.sun.com/developer/bugParade/bugs/4357573.html
    http://developer.java.sun.com/developer/bugParade/bugs/4320939.html
    There is also some discussion about this in various Forum threads. (Search for topics using "+getGlassPane +setCursor".)
    My corrected code follows. With this method, you don't even need to start up a secondary thread to get the cursor to change. I do, however, because I have other UI elements that I want to be updated (such as a sort indicator on my column headings.) I also reduce the priority of the sort thread a bit so my UI gets priority.
    Note that I removed the code that tries to remember the original cursor, since, with all the asynchronous execution going on, the wait cursor could actually be the frame's current cursor when this gets executed. If you're not doing a sub-thread as I am, you don't have to worry about this. Also, I have extended JFrame to JFrameBase to handle threading issues and consolidate redundant code (among other things not pictured here). The JFrameBase class definition follows the example code.
    Component lTopLevelComponent = JTableSortable.this.getTopLevelAncestor();
    final JFrameBase lFrame;
    if ( lTopLevelComponent instanceof JFrameBase )
        lFrame = (JFrameBase)lTopLevelComponent;
        lFrame.setFrameCursor( Cursor.getPredefinedCursor( Cursor.WAIT_CURSOR ) );
    else
        lFrame = null;
    Thread lSortThread = new Thread( "JTableSortable" ) {
        public void run()
            ((SortableTableModel)lModel).sortByColumn( lSortCol, lAscending );
            if ( lFrame != null )
                lFrame.setFrameCursor( Cursor.getPredefinedCursor( Cursor.DEFAULT_CURSOR ) );
    lSortThread.setPriority( Math.max( Thread.MIN_PRIORITY, Thread.currentThread().getPriority() - 1 ) );
    lSortThread.start();
    public class JFrameBase extends JFrame {
    public void setFrameCursor( final Cursor aCursor )
        SwingUtilities.invokeLater( new Runnable() {
            public void run()
                getGlassPane().setCursor( aCursor );
                getGlassPane().setVisible( true );

  • Change Cursor During Processing?

    Hi everybody!
    Is there a way to change the mouse cursor while processing a JSP page? For example my page looks like this:
    <HTML>
    <% change cursor to type 'wait' %>
    <% do a large task on the server which takes some time.... %>
    <% change cursor to default %>
    </HTML>
    Thanks in advance!
    /Paul

    No. A JSP does not have a mouse cursor, as it runs on the server and not on the client. Here's what happens in real life:
    1. At the client browser, the user clicks on a link or a Submit button.
    2. The server starts running the JSP file and turning it into HTML. The client does nothing but wait.
    3. When it is finished generating the HTML, it sends it to the client.

  • Customizing Cursor Color and/or appearance:  Does anyone know if you can change cursor color?

    Customizing Cursor Color and/or appearance:  Does anyone know if you can change cursor color in Mountain Lion? Any software for customizing and saving different cursors for Mountain Lion? Already have cursor size changed, but would like more options. Are more cursor customization options coming in future Mac OS X versions?

    There may be some haxies/3rd party s/w that can do this, but I've not heard of them.
    Customisation is limited on macs, unless you start hacking deep into the coreservices of the system - dodgy at best and almost certainly to get reset on the next update from Apple central
    Think different? Nooo....that was just a slogan.

  • Change cursor position?

    I have just completed creating 3 forms with 60+ text fields each with Acrobat X. To my dismay, I've discovered that when one types in the text field, the text appears in the middle (left justified) of the text box instead of at the top.
    How can I fix this/set the cursor position?
    Thanks!

    You need to change the text field(s) to multi-line text fields. This is found within the text field properties dialog in the options tab.
    Andrew

  • Change cursor over text fields

    Does anyone know how to change the mouse cursor, to a karat cursor, when the mouse is "hovering" over a JTextField or JTextArea?

    OK heres where I get lost...
    If you run this program then move the mouse over the JTextField the JFrame will change the cursor to a TEXT_CURSOR but the JDialog will not.
    Can anyone make this happen for a JDialog??
    import java.awt.Cursor;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseListener;
    import javax.swing.JDialog;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JTextField;
    public class JDialogMouseTest extends JPanel{
        JTextField textField;
        public JDialogMouseTest(){
            textField = new JTextField();
            textField.addMouseListener(new MouseListener(){
                public void mouseClicked(MouseEvent e) {
                public void mousePressed(MouseEvent e) {
                public void mouseReleased(MouseEvent e) {
                public void mouseEntered(MouseEvent e) {
                    mouseEnteredEvent(e);
                public void mouseExited(MouseEvent e) {
            add(textField);
        private void mouseEnteredEvent(MouseEvent e){
            textField.setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR));
        public static void main(String[] args){
            JDialog dialog = new JDialog();
            JDialogMouseTest mouseTest = new JDialogMouseTest();
            dialog.setContentPane(mouseTest);
            dialog.pack();
            dialog.setVisible(true);
            JDialogMouseTest mouseTest1 = new JDialogMouseTest();
            JFrame frame = new JFrame();
            frame.setContentPane(mouseTest1);
            frame.pack();
            frame.setVisible(true);
    }Message was edited by:
    boom_zap

  • Change cursor under script control

    It would very helpful to be able to display a 'wait' cursor while an Illustrator script is running. I have several scripts which work on large numbers of objects, and I'm sure anyone running them would appreciate seeing the spinning colourwheel or hourglass while the script is looping away.
    I understand that Adobe's Javascript Toolkit would let you build a progress-bar dialog, but the delays are rarely long enough to justify such a thing. All the same, a change of cursor would reassure users that things were indeed happening.
    Scripting is an important feature for Illustrator, not just in saving effort, time and frustration, but because the work of the scripting community invariably suggests new features to be built into the core product or into plug-ins. Often scripts are seen and used by numbers of people other than their original authors. Anything that builds confidence in scripting's utility and capability is likely to be a good thing - and not just for Illustrator.

    Thanks, Mark - helpful to know that you tried.
    I think we can take the answer to my question as a 'no'. I'll post a suggestion in the Land of Forlorn Hopes, aka Illustrator Feature Requests.

Maybe you are looking for