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");
}
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);
}
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();
}
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);
}
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);
}
Aggregations