Search in sources :

Example 66 with Toolkit

use of java.awt.Toolkit in project lionengine by b3dgs.

the class ToolsAwt method createHiddenCursor.

/**
 * Create a hidden cursor.
 *
 * @return Hidden cursor, or default cursor if not able to create it.
 */
public static Cursor createHiddenCursor() {
    final Toolkit toolkit = Toolkit.getDefaultToolkit();
    final Dimension dim = toolkit.getBestCursorSize(1, 1);
    final BufferedImage c = createImage(Math.max(1, dim.width), Math.max(1, dim.height), java.awt.Transparency.BITMASK);
    final BufferedImage buffer = applyMask(c, Color.BLACK.getRGB());
    return toolkit.createCustomCursor(buffer, new Point(0, 0), "hiddenCursor");
}
Also used : Toolkit(java.awt.Toolkit) Dimension(java.awt.Dimension) Point(java.awt.Point) BufferedImage(java.awt.image.BufferedImage)

Example 67 with Toolkit

use of java.awt.Toolkit in project jdk8u_jdk by JetBrains.

the class LoadToolkit method main.

public static void main(String[] args) {
    Toolkit kit = Toolkit.getDefaultToolkit();
    // This starts a thread which never exits - so we suicide.
    try {
        Thread.sleep(5000);
    } catch (Exception e) {
    }
    System.exit(0);
}
Also used : Toolkit(java.awt.Toolkit)

Example 68 with Toolkit

use of java.awt.Toolkit in project opennms by OpenNMS.

the class MacEditorKit method provideErrorFeedback.

/**
 * Invoked when the user attempts an invalid operation, such as pasting into
 * an uneditable <code>JTextField</code> that has focus. The default
 * implementation beeps. Subclasses that wish different behavior should
 * override this and provide the additional feedback.
 *
 * @param component Component the error occured in, may be null indicating
 *                  the error condition is not directly associated with a
 *                  <code>Component</code>.
 */
static void provideErrorFeedback(Component component) {
    Toolkit toolkit = null;
    if (component != null) {
        toolkit = component.getToolkit();
    } else {
        toolkit = Toolkit.getDefaultToolkit();
    }
    toolkit.beep();
}
Also used : Toolkit(java.awt.Toolkit)

Example 69 with Toolkit

use of java.awt.Toolkit in project freeplane by freeplane.

the class UITools method getScreenBounds.

public static Rectangle getScreenBounds(final GraphicsConfiguration graphicsConfiguration) {
    final Toolkit defaultToolkit = Toolkit.getDefaultToolkit();
    final Insets screenInsets = defaultToolkit.getScreenInsets(graphicsConfiguration);
    final Rectangle screenBounds = graphicsConfiguration.getBounds();
    final Point screenLocation = screenBounds.getLocation();
    final Dimension screenSize = screenBounds.getSize();
    final int screenWidth = screenSize.width - screenInsets.left - screenInsets.right;
    final int screenHeight = screenSize.height - screenInsets.top - screenInsets.bottom;
    return new Rectangle(screenLocation.x + screenInsets.left, screenLocation.y + screenInsets.top, screenWidth, screenHeight);
}
Also used : Insets(java.awt.Insets) Rectangle(java.awt.Rectangle) Toolkit(java.awt.Toolkit) Point(java.awt.Point) Dimension(java.awt.Dimension) Point(java.awt.Point)

Example 70 with Toolkit

use of java.awt.Toolkit in project artisynth_core by artisynth.

the class NumericProbePanel method createCursor.

private static Cursor createCursor(String fileName, String toolTip) {
    String imagePath = "artisynth/core/gui/timeline/BasicIcon/" + fileName;
    URL url = ArtisynthPath.getResource(imagePath);
    if (url == null) {
        System.out.println("Warning: can't find cursor image " + imagePath);
        return null;
    }
    try {
        url.openStream();
    } catch (Exception e) {
        System.out.println("Warning: can't open " + imagePath);
    }
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    Image image = toolkit.getImage(url);
    if (image == null) {
        System.out.println("Warning: can't find cursor image " + imagePath);
        return null;
    }
    return toolkit.createCustomCursor(image, new Point(0, 0), toolTip);
}
Also used : Toolkit(java.awt.Toolkit) Point(java.awt.Point) Image(java.awt.Image) URL(java.net.URL)

Aggregations

Toolkit (java.awt.Toolkit)95 Dimension (java.awt.Dimension)29 Point (java.awt.Point)21 Image (java.awt.Image)19 BufferedImage (java.awt.image.BufferedImage)14 URL (java.net.URL)14 GraphicsDevice (java.awt.GraphicsDevice)8 Insets (java.awt.Insets)8 GraphicsEnvironment (java.awt.GraphicsEnvironment)7 Rectangle (java.awt.Rectangle)7 IOException (java.io.IOException)6 Field (java.lang.reflect.Field)6 MediaTracker (java.awt.MediaTracker)5 ImageIcon (javax.swing.ImageIcon)5 Frame (java.awt.Frame)4 Clipboard (java.awt.datatransfer.Clipboard)4 BorderLayout (java.awt.BorderLayout)3 Font (java.awt.Font)3 Graphics (java.awt.Graphics)3 GraphicsConfiguration (java.awt.GraphicsConfiguration)3