use of java.awt.Toolkit in project pivot by apache.
the class Platform method initializeFontRenderContext.
private static void initializeFontRenderContext() {
Object aaHint = null;
Object fmHint = null;
Toolkit toolkit = Toolkit.getDefaultToolkit();
java.util.Map<?, ?> fontDesktopHints = (java.util.Map<?, ?>) toolkit.getDesktopProperty("awt.font.desktophints");
if (fontDesktopHints != null) {
aaHint = fontDesktopHints.get(RenderingHints.KEY_TEXT_ANTIALIASING);
fmHint = fontDesktopHints.get(RenderingHints.KEY_FRACTIONALMETRICS);
}
if (aaHint == null) {
aaHint = RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT;
}
if (fmHint == null) {
fmHint = RenderingHints.VALUE_FRACTIONALMETRICS_DEFAULT;
}
fontRenderContext = new FontRenderContext(null, aaHint, fmHint);
}
use of java.awt.Toolkit in project pivot by apache.
the class Platform method getMultiClickInterval.
/**
* @return The system multi-click interval.
*/
public static int getMultiClickInterval() {
Toolkit toolkit = Toolkit.getDefaultToolkit();
Integer multiClickInterval = (Integer) toolkit.getDesktopProperty("awt.multiClickInterval");
if (multiClickInterval == null) {
multiClickInterval = Integer.valueOf(DEFAULT_MULTI_CLICK_INTERVAL);
}
return multiClickInterval.intValue();
}
use of java.awt.Toolkit in project pivot by apache.
the class LabelAntialiasTest method showFontDesktopHints.
/**
* Write to console some details of Desktop Hints, for Font Rendering.
*
* @see org.apache.pivot.wtk.Platform#initializeFontRenderContext
*/
private void showFontDesktopHints() {
System.out.println("Show Font Desktop Hints:");
Toolkit toolkit = Toolkit.getDefaultToolkit();
java.util.Map<?, ?> fontDesktopHints = (java.util.Map<?, ?>) toolkit.getDesktopProperty("awt.font.desktophints");
System.out.println(fontDesktopHints);
}
use of java.awt.Toolkit in project com.revolsys.open by revolsys.
the class Viewport2D method getScreenResolution.
public int getScreenResolution() {
final Toolkit defaultToolkit = Toolkit.getDefaultToolkit();
final int screenResolution = defaultToolkit.getScreenResolution();
return 96;
}
use of java.awt.Toolkit in project ffx by mjschnie.
the class MainPanel method loadPrefs.
/**
* Load preferences from the user node
*/
public void loadPrefs() {
String c = MainPanel.class.getName();
JFrame frame1 = (JFrame) SwingUtilities.getRoot(this);
Toolkit toolkit = getToolkit();
Dimension screenSize = toolkit.getScreenSize();
int x = preferences.getInt(c + ".x", screenSize.width / 8);
int y = preferences.getInt(c + ".y", screenSize.height / 8);
int width = preferences.getInt(c + ".width", screenSize.width * 3 / 4);
int height = preferences.getInt(c + ".height", screenSize.height * 3 / 4);
if (width > screenSize.width * 0.4 && width < screenSize.width * 0.8 && height > screenSize.height * 0.4 && height < screenSize.height * 0.8) {
frame1.setSize(width, height);
} else {
frame1.setSize(screenSize.width * 4 / 5, screenSize.height * 4 / 5);
}
if (x > 0 && x < screenSize.width / 2 && y > 0 && y < screenSize.height / 2) {
frame1.setLocation(x, y);
} else {
frame1.setLocation(screenSize.width / 8, screenSize.height / 8);
}
splitPaneDivider = preferences.getInt(c + ".divider", 200);
if (splitPaneDivider < frame1.getWidth() * (1.0f / 4.0f)) {
splitPaneDivider = (int) (frame1.getWidth() * (1.0f / 4.0f));
}
splitPane.setDividerLocation(splitPaneDivider);
if (!preferences.getBoolean(c + ".system", true)) {
mainMenu.setSystemShowing(false);
splitPane.setDividerLocation(0);
} else {
mainMenu.setSystemShowing(true);
}
if (!preferences.getBoolean(c + ".menu", true)) {
remove(mainMenu.getToolBar());
mainMenu.setMenuShowing(false);
validate();
} else {
mainMenu.setMenuShowing(true);
}
try {
port = preferences.getInt(c + ".port", 2000);
ip = preferences.get(c + ".ip", InetAddress.getLocalHost().getHostAddress());
if (ip != null) {
address = InetAddress.getByName(ip);
socketAddress = new InetSocketAddress(address, port);
} else {
socketAddress = new InetSocketAddress(port);
}
} catch (Exception e) {
logger.log(Level.WARNING, e.toString());
}
if (graphicsCanvas != null) {
graphicsCanvas.loadPrefs();
}
}
Aggregations