Search in sources :

Example 6 with Cursor

use of java.awt.Cursor in project processing by processing.

the class JavaTextAreaPainter method updateCursor.

private void updateCursor(int mouseX, int mouseY) {
    int currentTab = getCurrentCodeIndex();
    for (Handle n : handles.get(currentTab)) {
        if (n.pick(mouseX, mouseY)) {
            cursorType = Cursor.W_RESIZE_CURSOR;
            setCursor(new Cursor(cursorType));
            return;
        }
    }
    for (ColorControlBox colorBox : colorBoxes.get(currentTab)) {
        if (colorBox.pick(mouseX, mouseY)) {
            cursorType = Cursor.HAND_CURSOR;
            setCursor(new Cursor(cursorType));
            return;
        }
    }
    if (cursorType == Cursor.W_RESIZE_CURSOR || cursorType == Cursor.HAND_CURSOR || cursorType == -1) {
        cursorType = Cursor.DEFAULT_CURSOR;
        setCursor(new Cursor(cursorType));
    }
}
Also used : ColorControlBox(processing.mode.java.tweak.ColorControlBox) Cursor(java.awt.Cursor) Point(java.awt.Point) Handle(processing.mode.java.tweak.Handle)

Example 7 with Cursor

use of java.awt.Cursor in project libgdx by libgdx.

the class LwjglAWTInput method showCursor.

private void showCursor(boolean visible) {
    if (!visible) {
        Toolkit t = Toolkit.getDefaultToolkit();
        Image i = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB);
        Cursor noCursor = t.createCustomCursor(i, new Point(0, 0), "none");
        JFrame frame = findJFrame(canvas);
        frame.setCursor(noCursor);
    } else {
        JFrame frame = findJFrame(canvas);
        frame.setCursor(Cursor.getDefaultCursor());
    }
}
Also used : JFrame(javax.swing.JFrame) Toolkit(java.awt.Toolkit) Point(java.awt.Point) Image(java.awt.Image) BufferedImage(java.awt.image.BufferedImage) Cursor(java.awt.Cursor) BufferedImage(java.awt.image.BufferedImage)

Example 8 with Cursor

use of java.awt.Cursor in project voltdb by VoltDB.

the class Grid method mouseMove.

/**
     * Method declaration
     *
     *
     * @param e
     * @param x
     * @param y
     */
public boolean mouseMove(Event e, int x, int y) {
    if (y <= iRowHeight) {
        int xb = x;
        x += iX - iGridWidth;
        int i = iColCount - 1;
        for (; i >= 0; i--) {
            if (x > -7 && x < 7) {
                break;
            }
            x += iColWidth[i];
        }
        if (i >= 0) {
            if (!bDrag) {
                setCursor(new Cursor(Cursor.E_RESIZE_CURSOR));
                bDrag = true;
                iXDrag = xb - iColWidth[i];
                iColDrag = i;
            }
            return true;
        }
    }
    return mouseExit(e, x, y);
}
Also used : Cursor(java.awt.Cursor)

Example 9 with Cursor

use of java.awt.Cursor in project voltdb by VoltDB.

the class Grid method mouseExit.

/**
     * Method declaration
     *
     *
     * @param e
     * @param x
     * @param y
     */
public boolean mouseExit(Event e, int x, int y) {
    if (bDrag) {
        setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
        bDrag = false;
    }
    return true;
}
Also used : Cursor(java.awt.Cursor)

Example 10 with Cursor

use of java.awt.Cursor in project adempiere by adempiere.

the class PDFViewerBean method print.

public void print() {
    PrinterJob printJob = PrinterJob.getPrinterJob();
    //decoder.enableScaledPrinting(false);
    printJob.setPageable(decoder);
    final PageFormat pf = printJob.defaultPage();
    decoder.setPageFormat(pf);
    decoder.setTextPrint(PdfDecoder.TEXTGLYPHPRINT);
    printJob.setPrintable(decoder, pf);
    if (printJob.printDialog()) {
        final Cursor oldCursor = getCursor();
        try {
            setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
            printJob.print();
        } catch (PrinterException e) {
            e.printStackTrace();
        } finally {
            setCursor(oldCursor);
        }
    }
}
Also used : PageFormat(java.awt.print.PageFormat) PrinterException(java.awt.print.PrinterException) Cursor(java.awt.Cursor) PrinterJob(java.awt.print.PrinterJob)

Aggregations

Cursor (java.awt.Cursor)34 Point (java.awt.Point)8 Component (java.awt.Component)6 MouseEvent (java.awt.event.MouseEvent)4 JFrame (javax.swing.JFrame)4 File (java.io.File)3 IOException (java.io.IOException)3 JFileChooser (javax.swing.JFileChooser)3 JPanel (javax.swing.JPanel)3 BorderLayout (java.awt.BorderLayout)2 Dimension (java.awt.Dimension)2 StringSelection (java.awt.datatransfer.StringSelection)2 InvalidDnDOperationException (java.awt.dnd.InvalidDnDOperationException)2 MouseAdapter (java.awt.event.MouseAdapter)2 WindowEvent (java.awt.event.WindowEvent)2 PrinterException (java.awt.print.PrinterException)2 FileFilter (javax.swing.filechooser.FileFilter)2 FileNameExtensionFilter (javax.swing.filechooser.FileNameExtensionFilter)2 JTextComponent (javax.swing.text.JTextComponent)2 PCGFile (pcgen.io.PCGFile)2