Example usage for java.awt Cursor DEFAULT_CURSOR

List of usage examples for java.awt Cursor DEFAULT_CURSOR

Introduction

In this page you can find the example usage for java.awt Cursor DEFAULT_CURSOR.

Prototype

int DEFAULT_CURSOR

To view the source code for java.awt Cursor DEFAULT_CURSOR.

Click Source Link

Document

The default cursor type (gets set if no cursor is defined).

Usage

From source file:Main.java

public static void main(String[] args) {
    JFrame aWindow = new JFrame();
    aWindow.setBounds(200, 200, 200, 200);
    aWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    aWindow.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    aWindow.setVisible(true);//from  ww w  .j av a2 s .  co m
}

From source file:Main.java

public static void setBusyCursor(Component comp, boolean busy) {
    if (busy) {/*from www  . j a va  2  s .  c o  m*/
        comp.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    } else {
        comp.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    }
}

From source file:Main.java

public static void setDefaultCursor(Component comp) {
    comp.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
}

From source file:Main.java

/**
 * @param frame//from  ww  w  . j  a  v  a 2  s .  c o  m
 * @param progressBar
 */
private static void closeFrame(JFrame frame, JProgressBar progressBar) {
    frame.setVisible(false);
    frame.setCursor(java.awt.Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}

From source file:Main.java

public void run() {
    int count = 0;
    while (animate) {
        try {//w w w  . j a  v a  2s.  c o  m
            Thread.currentThread().sleep(200);
        } catch (Exception ex) {
        }
        frame.setCursor(cursors[count % cursors.length]);
        count++;
    }
    frame.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}

From source file:org.argouml.application.Main.java

/**
 * The main entry point of ArgoUML.//from w  w  w.j ava 2s . com
 * @param args command line parameters
 */
public static void main(String[] args) {
    try {
        LOG.info("ArgoUML Started.");

        SimpleTimer st = new SimpleTimer();
        st.mark("begin");

        initPreinitialize();

        st.mark("arguments");
        parseCommandLine(args);

        // Register our last chance exception handler
        AwtExceptionHandler.registerExceptionHandler();

        // Get the splash screen up as early as possible
        st.mark("create splash");
        SplashScreen splash = null;
        if (!batch) {
            // We have to do this to set the LAF for the splash screen
            st.mark("initialize laf");
            LookAndFeelMgr.getInstance().initializeLookAndFeel();
            if (theTheme != null) {
                LookAndFeelMgr.getInstance().setCurrentTheme(theTheme);
            }
            if (doSplash) {
                splash = initializeSplash();
            }
        }

        // main initialization happens here
        ProjectBrowser pb = initializeSubsystems(st, splash);

        // Needs to happen after initialization is done & modules loaded
        st.mark("perform commands");
        if (batch) {
            // TODO: Add an "open most recent project" command so that 
            // command state can be decoupled from user settings?
            performCommandsInternal(commands);
            commands = null;

            System.out.println("Exiting because we are running in batch.");
            new ActionExit().doCommand(null);
            return;
        }

        if (reloadRecent && projectName == null) {
            projectName = getMostRecentProject();
        }

        URL urlToOpen = null;
        if (projectName != null) {
            projectName = PersistenceManager.getInstance().fixExtension(projectName);
            urlToOpen = projectUrl(projectName, urlToOpen);
        }

        openProject(st, splash, pb, urlToOpen);

        st.mark("perspectives");
        if (splash != null) {
            splash.updateProgress(75);
        }

        st.mark("open window");
        updateProgress(splash, 95, "statusmsg.bar.open-project-browser");
        ArgoFrame.getFrame().setVisible(true);

        st.mark("close splash");
        if (splash != null) {
            splash.setVisible(false);
            splash.dispose();
            splash = null;
        }

        // Aufrufen der Aufgabenstellung
        if (taskID != null) {
            ActionShowTask task = new ActionShowTask();
            task.showTask();
            if (projectName == null && ActionShowTask.taskDescription != null
                    && (ActionShowTask.taskDescription.toLowerCase().contains("aktivittsdiagramm")
                            || ActionShowTask.taskDescription.toLowerCase().contains("aktivitts-diagramm")
                            || ActionShowTask.taskDescription.toLowerCase().contains("aktivitätsdiagramm")
                            || ActionShowTask.taskDescription.toLowerCase().contains("aktivitäts-diagramm")
                            || ActionShowTask.taskDescription.toLowerCase().contains("activity diagram")
                            || ActionShowTask.taskDescription.toLowerCase().contains("activity-diagram"))) {
                new ActionActivityDiagram().actionPerformed(null);
            }
        }

        performCommands(commands);
        commands = null;

        st.mark("start critics");
        Runnable startCritics = new StartCritics();
        Main.addPostLoadAction(startCritics);

        st.mark("start loading modules");
        Runnable moduleLoader = new LoadModules();
        Main.addPostLoadAction(moduleLoader);

        PostLoad pl = new PostLoad(postLoadActions);
        Thread postLoadThead = new Thread(pl);
        postLoadThead.start();

        LOG.info("");
        LOG.info("profile of load time ############");
        for (Enumeration i = st.result(); i.hasMoreElements();) {
            LOG.info(i.nextElement());
        }
        LOG.info("#################################");
        LOG.info("");

        st = null;
        ArgoFrame.getFrame().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));

        // Andreas: just temporary: a warning dialog for uml2...
        if (showUml2warning && Model.getFacade().getUmlVersion().startsWith("2")) {
            JOptionPane.showMessageDialog(ArgoFrame.getFrame(),
                    "You are running an experimental version not meant for productive work!",
                    "UML2 pre-alpha warning", JOptionPane.WARNING_MESSAGE);
        }

        //ToolTipManager.sharedInstance().setInitialDelay(500);
        ToolTipManager.sharedInstance().setDismissDelay(50000000);
    } catch (Throwable t) {
        try {
            LOG.fatal("Fatal error on startup.  ArgoUML failed to start", t);
        } finally {
            System.out.println("Fatal error on startup.  " + "ArgoUML failed to start.");
            t.printStackTrace();
            System.exit(1);
        }
    }
}

From source file:Main.java

@Override
public void run() {
    for (int i = 0; i < fnt.length; i++) {
        StyleConstants.setBold(mas, false);
        StyleConstants.setItalic(mas, false);
        StyleConstants.setFontFamily(mas, fnt[i]);
        StyleConstants.setFontSize(mas, 16);
        dis(fnt[i]);/*  ww  w .j  av a2s .  c om*/
        try {
            Thread.sleep(75);
        } catch (Exception e) {
            e.printStackTrace();
        }
        StyleConstants.setBold(mas, true);
        dis(fnt[i] + " Bold");
        try {
            Thread.sleep(75);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    jta.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}

From source file:Main.java

public GrabAndScrollLabel(ImageIcon i) {
    super(i);/*from   ww  w  .  ja  va  2  s  .c o  m*/

    MouseInputAdapter mia = new MouseInputAdapter() {
        int xDiff, yDiff;
        Container c;

        public void mouseDragged(MouseEvent e) {
            c = GrabAndScrollLabel.this.getParent();
            if (c instanceof JViewport) {
                JViewport jv = (JViewport) c;
                Point p = jv.getViewPosition();
                int newX = p.x - (e.getX() - xDiff);
                int newY = p.y - (e.getY() - yDiff);

                int maxX = GrabAndScrollLabel.this.getWidth() - jv.getWidth();
                int maxY = GrabAndScrollLabel.this.getHeight() - jv.getHeight();
                if (newX < 0)
                    newX = 0;
                if (newX > maxX)
                    newX = maxX;
                if (newY < 0)
                    newY = 0;
                if (newY > maxY)
                    newY = maxY;

                jv.setViewPosition(new Point(newX, newY));
            }
        }

        public void mousePressed(MouseEvent e) {
            setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
            xDiff = e.getX();
            yDiff = e.getY();
        }

        public void mouseReleased(MouseEvent e) {
            setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
        }
    };
    addMouseMotionListener(mia);
    addMouseListener(mia);
}

From source file:com.mirth.connect.client.ui.components.MirthIconTextField.java

public MirthIconTextField(ImageIcon icon) {
    setIcon(icon);/*from  w w w  . ja v  a  2s. c  om*/

    addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent evt) {
            if (isIconActive(evt) && iconPopupMenuComponent != null) {
                JPopupMenu iconPopupMenu = new JPopupMenu();
                iconPopupMenu.insert(iconPopupMenuComponent, 0);
                iconPopupMenu.show(evt.getComponent(), evt.getX(), evt.getY());
            }
        }
    });

    addMouseMotionListener(new MouseMotionAdapter() {
        @Override
        public void mouseMoved(MouseEvent evt) {
            int cursorType = getCursor().getType();

            if (isIconActive(evt)) {
                if (StringUtils.isNotBlank(alternateToolTipText)) {
                    MirthIconTextField.super.setToolTipText(alternateToolTipText);
                }

                if (iconPopupMenuComponent != null) {
                    if (cursorType != Cursor.HAND_CURSOR) {
                        setCursor(new Cursor(Cursor.HAND_CURSOR));
                    }
                } else {
                    if (cursorType != Cursor.DEFAULT_CURSOR) {
                        setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
                    }
                }
            } else {
                if (StringUtils.isNotBlank(alternateToolTipText)) {
                    MirthIconTextField.super.setToolTipText(originalToolTipText);
                }

                if (cursorType != Cursor.TEXT_CURSOR) {
                    setCursor(new Cursor(Cursor.TEXT_CURSOR));
                }
            }
        }
    });
}

From source file:org.jcurl.demo.editor.LocationController.java

/**
 * /* w w  w  .j a  v a  2  s .  c o  m*/
 * @param model
 *            final. Sets the <code>panel</code>'s model.
 * @param panel
 *            required for wc <->dc conversion. Repaint is triggered via
 *            {@link org.jcurl.core.base.RockSet#notifyChange()}.
 */
public LocationController(final PositionSet model, final PositionDisplay panel) {
    panel.addMouseMotionListener(this);
    panel.setPos(model);

    this.panel = panel;
    locations = model;
    // this.model.addPropertyChangeListener(this);
    CursorDefault = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
    CursorIn = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR);
}