本文整理匯總了Java中java.awt.DisplayMode.REFRESH_RATE_UNKNOWN屬性的典型用法代碼示例。如果您正苦於以下問題:Java DisplayMode.REFRESH_RATE_UNKNOWN屬性的具體用法?Java DisplayMode.REFRESH_RATE_UNKNOWN怎麽用?Java DisplayMode.REFRESH_RATE_UNKNOWN使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類java.awt.DisplayMode
的用法示例。
在下文中一共展示了DisplayMode.REFRESH_RATE_UNKNOWN屬性的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getScreenRefreshRate
int getScreenRefreshRate() {
int rate = 60;
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] gs = ge.getScreenDevices();
for (int i = 0; i < gs.length; i++) {
DisplayMode dm = gs[i].getDisplayMode();
// Get refresh rate in Hz
int refreshRate = dm.getRefreshRate();
if (refreshRate == DisplayMode.REFRESH_RATE_UNKNOWN) {
// log.warning("MotionViewer.getScreenRefreshRate: got unknown refresh rate for screen "+i+", assuming 60");
refreshRate = 60;
} else {
// log.info("MotionViewer.getScreenRefreshRate: screen "+i+" has refresh rate "+refreshRate);
}
if (i == 0) {
rate = refreshRate;
}
}
return rate;
}
示例2: getScreenRefreshRate
int getScreenRefreshRate() {
int rate = 60;
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
if (ge == null) {
return rate;
}
GraphicsDevice[] gs = ge.getScreenDevices();
for (int i = 0; i < gs.length; i++) {
DisplayMode dm = gs[i].getDisplayMode();
// Get refresh rate in Hz
if (dm == null) {
return rate;
}
int refreshRate = dm.getRefreshRate();
if (refreshRate == DisplayMode.REFRESH_RATE_UNKNOWN) {
log.warning("AEViewer.getScreenRefreshRate: got unknown refresh rate for screen " + i + ", assuming 60");
refreshRate = 60;
} else {
// log.info("AEViewer.getScreenRefreshRate: screen "+i+" has refresh rate "+refreshRate);
}
if (i == 0) {
rate = refreshRate;
}
}
return rate;
}
示例3: getMatchingDisplayMode
protected synchronized DisplayMode getMatchingDisplayMode(DisplayMode dm) {
if (!isDisplayChangeSupported()) {
return null;
}
DisplayMode[] modes = getDisplayModes();
for (DisplayMode mode : modes) {
if (dm.equals(mode) ||
(dm.getRefreshRate() == DisplayMode.REFRESH_RATE_UNKNOWN &&
dm.getWidth() == mode.getWidth() &&
dm.getHeight() == mode.getHeight() &&
dm.getBitDepth() == mode.getBitDepth()))
{
return mode;
}
}
return null;
}
示例4: getMatchingDisplayMode
private synchronized DisplayMode getMatchingDisplayMode(DisplayMode dm) {
if (!isDisplayChangeSupported()) {
return null;
}
DisplayMode[] modes = getDisplayModes();
for (DisplayMode mode : modes) {
if (dm.equals(mode) ||
(dm.getRefreshRate() == DisplayMode.REFRESH_RATE_UNKNOWN &&
dm.getWidth() == mode.getWidth() &&
dm.getHeight() == mode.getHeight() &&
dm.getBitDepth() == mode.getBitDepth()))
{
return mode;
}
}
return null;
}
示例5: getDefaultDisplayMode
private DisplayMode getDefaultDisplayMode() {
GraphicsConfiguration gc = getDefaultConfiguration();
Rectangle r = gc.getBounds();
return new DisplayMode(r.width, r.height,
DisplayMode.BIT_DEPTH_MULTI,
DisplayMode.REFRESH_RATE_UNKNOWN);
}