use of java.awt.Toolkit in project cytoscape-impl by cytoscape.
the class CytoscapeDesktop method setLocationOfFloatingFrame.
private void setLocationOfFloatingFrame(JFrame frame, CytoPanelImpl cytoPanel) {
Toolkit tk = Toolkit.getDefaultToolkit();
Dimension screenDimension = tk.getScreenSize();
// Get Absolute Location and Bounds, relative to Screen
Rectangle bounds = getBounds();
bounds.setLocation(getLocationOnScreen());
Point p = CytoPanelUtil.getLocationOfExternalWindow(screenDimension, bounds, frame.getSize(), cytoPanel.getCytoPanelName(), false);
frame.setLocation(p);
frame.setVisible(true);
}
use of java.awt.Toolkit in project elki by elki-project.
the class TreePopup method computePopupBounds.
protected Rectangle computePopupBounds(Component parent, int px, int py, int pw, int ph) {
Toolkit toolkit = Toolkit.getDefaultToolkit();
Rectangle screenBounds;
// Calculate the desktop dimensions relative to the combo box.
GraphicsConfiguration gc = parent.getGraphicsConfiguration();
Point p = new Point();
SwingUtilities.convertPointFromScreen(p, parent);
if (gc != null) {
Insets screenInsets = toolkit.getScreenInsets(gc);
screenBounds = gc.getBounds();
screenBounds.width -= (screenInsets.left + screenInsets.right);
screenBounds.height -= (screenInsets.top + screenInsets.bottom);
screenBounds.x += (p.x + screenInsets.left);
screenBounds.y += (p.y + screenInsets.top);
} else {
screenBounds = new Rectangle(p, toolkit.getScreenSize());
}
Rectangle rect = new Rectangle(px, py, pw, ph);
if (py + ph > screenBounds.y + screenBounds.height && ph < screenBounds.height) {
rect.y = -rect.height;
}
return rect;
}
use of java.awt.Toolkit in project pivot by apache.
the class Platform method getCursorBlinkRate.
/**
* @return The system cursor blink rate.
*/
public static int getCursorBlinkRate() {
Toolkit toolkit = Toolkit.getDefaultToolkit();
Integer cursorBlinkRate = (Integer) toolkit.getDesktopProperty("awt.cursorBlinkRate");
if (cursorBlinkRate == null) {
cursorBlinkRate = Integer.valueOf(DEFAULT_CURSOR_BLINK_RATE);
}
return cursorBlinkRate.intValue();
}
use of java.awt.Toolkit in project com.revolsys.open by revolsys.
the class ClipboardUtil method getClipboard.
public static Clipboard getClipboard() {
final Toolkit toolkit = Toolkit.getDefaultToolkit();
final Clipboard clipboard = toolkit.getSystemClipboard();
return clipboard;
}
use of java.awt.Toolkit in project beast2 by CompEvol.
the class Utils6 method startSplashScreen.
/*
This could live in the desktop script.
However we'd like to get it on the screen as quickly as possible.
*/
public static void startSplashScreen() {
Image img = getIcon("beast/app/draw/icons/beauti.png").getImage();
int width = 2 * img.getWidth(null), height = img.getHeight(null);
Window win = new Window(new Frame());
win.pack();
can = new Canvas();
// why is this necessary?
can.setSize(width, height);
Toolkit tk = Toolkit.getDefaultToolkit();
Dimension dim = tk.getScreenSize();
win.setBounds(dim.width / 2 - width / 2, dim.height / 2 - height / 2, width, height);
win.add("Center", can);
// Image img=tk.getImage(
// Utils.class.getResource("beast.png") ); //what
MediaTracker mt = new MediaTracker(can);
mt.addImage(img, 0);
try {
mt.waitForAll();
} catch (Exception e) {
}
Graphics gr = can.getBufferedGraphics();
gr.drawImage(img, width / 4, 0, can);
win.setVisible(true);
win.toFront();
splashScreen = win;
}
Aggregations