當前位置: 首頁>>代碼示例>>Java>>正文


Java GraphicsEnvironment.isHeadless方法代碼示例

本文整理匯總了Java中java.awt.GraphicsEnvironment.isHeadless方法的典型用法代碼示例。如果您正苦於以下問題:Java GraphicsEnvironment.isHeadless方法的具體用法?Java GraphicsEnvironment.isHeadless怎麽用?Java GraphicsEnvironment.isHeadless使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.awt.GraphicsEnvironment的用法示例。


在下文中一共展示了GraphicsEnvironment.isHeadless方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: canAccessSystemClipboard

import java.awt.GraphicsEnvironment; //導入方法依賴的package包/類
private boolean canAccessSystemClipboard() {
    boolean b = false;

    if (!GraphicsEnvironment.isHeadless()) {
        SecurityManager sm = System.getSecurityManager();
        if (sm != null) {
            try {
                sm.checkPermission(AWTPermissions.ACCESS_CLIPBOARD_PERMISSION);
                b = true;
            } catch (SecurityException se) {
                if (logger.isLoggable(PlatformLogger.Level.FINE)) {
                    logger.fine("InputEvent.canAccessSystemClipboard() got SecurityException ", se);
                }
            }
        } else {
            b = true;
        }
    }

    return b;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:22,代碼來源:InputEvent.java

示例2: NativeFont

import java.awt.GraphicsEnvironment; //導入方法依賴的package包/類
/**
 * Verifies native font is accessible.
 * @throws FontFormatException - if the font can't be located.
 */
public NativeFont(String platName, boolean bitmapDelegate)
    throws FontFormatException {
    super(platName, null);

    /* This is set true if this is an instance of a NativeFont
     * created by some other font, to get native bitmaps.
     * The delegating font will call this font only for "basic"
     * cases - ie non-rotated, uniform scale, monochrome bitmaps.
     * If this is false, then this instance may need to itself
     * delegate to another font for non-basic cases. Since
     * NativeFonts are used in that way only for symbol and dingbats
     * we know its safe to delegate these to the JRE's default
     * physical font (Lucida Sans Regular).
     */
    isBitmapDelegate = bitmapDelegate;

    if (GraphicsEnvironment.isHeadless()) {
        throw new FontFormatException("Native font in headless toolkit");
    }
    fontRank = Font2D.NATIVE_RANK;
    initNames();
    if (getNumGlyphs() == 0) {
      throw new FontFormatException("Couldn't locate font" + platName);
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:30,代碼來源:NativeFont.java

示例3: createInputMethodWindow

import java.awt.GraphicsEnvironment; //導入方法依賴的package包/類
static Window createInputMethodWindow(String title, InputContext context, boolean isSwing) {
    if (GraphicsEnvironment.isHeadless()) {
        throw new HeadlessException();
    }
    if (isSwing) {
        return new InputMethodJFrame(title, context);
    } else {
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        if (toolkit instanceof InputMethodSupport) {
            return ((InputMethodSupport)toolkit).createInputMethodWindow(
                title, context);
        }
    }
    throw new InternalError("Input methods must be supported");
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:16,代碼來源:InputMethodContext.java

示例4: invoke

import java.awt.GraphicsEnvironment; //導入方法依賴的package包/類
private static void invoke( WaitCursor wc ) {
    if (GraphicsEnvironment.isHeadless()) {
        return;
    }
    if ( SwingUtilities.isEventDispatchThread() ) {
        wc.run();
    }
    else {
        SwingUtilities.invokeLater( wc );
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:ProjectUtilities.java

示例5: disposeStrike

import java.awt.GraphicsEnvironment; //導入方法依賴的package包/類
static void disposeStrike(final FontStrikeDisposer disposer) {
    // we need to execute the strike disposal on the rendering thread
    // because they may be accessed on that thread at the time of the
    // disposal (for example, when the accel. cache is invalidated)

    // Whilst this is a bit heavyweight, in most applications
    // strike disposal is a relatively infrequent operation, so it
    // doesn't matter. But in some tests that use vast numbers
    // of strikes, the switching back and forth is measurable.
    // So the "pollRemove" call is added to batch up the work.
    // If we are polling we know we've already been called back
    // and can directly dispose the record.
    // Also worrisome is the necessity of getting a GC here.

    if (Disposer.pollingQueue) {
        doDispose(disposer);
        return;
    }

    RenderQueue rq = null;
    GraphicsEnvironment ge =
        GraphicsEnvironment.getLocalGraphicsEnvironment();
    if (!GraphicsEnvironment.isHeadless()) {
        GraphicsConfiguration gc =
            ge.getDefaultScreenDevice().getDefaultConfiguration();
        if (gc instanceof AccelGraphicsConfig) {
            AccelGraphicsConfig agc = (AccelGraphicsConfig)gc;
            BufferedContext bc = agc.getContext();
            if (bc != null) {
                rq = bc.getRenderQueue();
            }
        }
    }
    if (rq != null) {
        rq.lock();
        try {
            rq.flushAndInvokeNow(new Runnable() {
                public void run() {
                    doDispose(disposer);
                    Disposer.pollRemove();
                }
            });
        } finally {
            rq.unlock();
        }
    } else {
        doDispose(disposer);
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:50,代碼來源:StrikeCache.java

示例6: suite

import java.awt.GraphicsEnvironment; //導入方法依賴的package包/類
public static Test suite() {
    return GraphicsEnvironment.isHeadless() ? new TestSuite() : new TestSuite(NbClipboardIsUsedBySwingComponentsTest.class);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:4,代碼來源:NbClipboardIsUsedBySwingComponentsTest.java

示例7: suite

import java.awt.GraphicsEnvironment; //導入方法依賴的package包/類
public static Test suite() {
    return GraphicsEnvironment.isHeadless() ? new TestSuite() : new TestSuite(MultiSplitPaneTest.class);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:4,代碼來源:MultiSplitPaneTest.java

示例8: placePointFromList

import java.awt.GraphicsEnvironment; //導入方法依賴的package包/類
public boolean placePointFromList(Frame parent) {
    if (this.placeList == null || !placeList.isInitialized()) {
        this.placeList = new PlaceList();
        placeList.askUserForFile(parent);
    }

    if (!placeList.isInitialized()) {
        return false; // user canceled
    }
    Object[] res = placeList.askUserForPlace();
    if (res == null) {
        return false; // user canceled
    }
    PlaceList.Point p = (PlaceList.Point) res[1];
    if (p == null) {
        return false;
    }
    final String newPointName = (String) res[0];

    GeoPoint pointWithSameName = this.linkManager.searchPoint(newPointName, false);
    if (pointWithSameName != null) {
        if (!GraphicsEnvironment.isHeadless()) {
            String msg = "A point with the name \"" + newPointName
                    + "\" already exists.\n"
                    + "Do you really want to add another point with the the same name?";
            String title = "Point With Identical Name";
            Object[] options = {"Add Point", "Cancel"};
            javax.swing.Icon icon = ika.mapanalyst.ApplicationInfo.getApplicationIcon();
            final int option = javax.swing.JOptionPane.showOptionDialog(
                    parent, msg, title,
                    javax.swing.JOptionPane.DEFAULT_OPTION,
                    javax.swing.JOptionPane.WARNING_MESSAGE,
                    icon, options, options[1]);
            if (option == 1 || option == javax.swing.JOptionPane.CLOSED_OPTION) {
                return false;   // user canceled
            }
        }
    }
    GeoPoint newPt = new GeoPoint(p.x, p.y);
    newPt.setName(newPointName);
    newPt.setSelected(true);
    GeoSet newPointsGeoSet = this.getNewPointsGeoSet();
    // deselect all pre-existing points in new map
    newPointsGeoSet.setSelected(false);
    newPointsGeoSet.addGeoObject(newPt);
    return true;
}
 
開發者ID:berniejenny,項目名稱:MapAnalyst,代碼行數:48,代碼來源:Manager.java

示例9: suite

import java.awt.GraphicsEnvironment; //導入方法依賴的package包/類
public static Test suite() {
    return GraphicsEnvironment.isHeadless() ? new TestSuite() : new TestSuite(TreeTableView152857Test.class);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:4,代碼來源:TreeTableView152857Test.java

示例10: isHeadless

import java.awt.GraphicsEnvironment; //導入方法依賴的package包/類
private static boolean isHeadless() {
    return GraphicsEnvironment.isHeadless();
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:4,代碼來源:EffectUtils.java

示例11: suite

import java.awt.GraphicsEnvironment; //導入方法依賴的package包/類
public static Test suite() {
    return GraphicsEnvironment.isHeadless() ? new TestSuite() : new TestSuite(ExternalDeleteOfModifiedContentTest.class);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:4,代碼來源:ExternalDeleteOfModifiedContentTest.java

示例12: suite

import java.awt.GraphicsEnvironment; //導入方法依賴的package包/類
public static Test suite() {
    return GraphicsEnvironment.isHeadless() ? new TestSuite() : new TestSuite(CloneableEditorSupportRedirectorTest.class);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:4,代碼來源:CloneableEditorSupportRedirectorTest.java

示例13: suite

import java.awt.GraphicsEnvironment; //導入方法依賴的package包/類
public static Test suite() {
    return GraphicsEnvironment.isHeadless() ? new TestSuite() : new TestSuite(PropertyPanelTest.class);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:4,代碼來源:PropertyPanelTest.java

示例14: suite

import java.awt.GraphicsEnvironment; //導入方法依賴的package包/類
public static Test suite() {
    return GraphicsEnvironment.isHeadless() ? new TestSuite() : new TestSuite(MultiViewEditorCloneTest.class);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:4,代碼來源:MultiViewEditorCloneTest.java

示例15: suite

import java.awt.GraphicsEnvironment; //導入方法依賴的package包/類
public static Test suite() {
    return GraphicsEnvironment.isHeadless() ? new TestSuite() : new TestSuite(CloseOperationHandlerTest.class);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:4,代碼來源:CloseOperationHandlerTest.java


注:本文中的java.awt.GraphicsEnvironment.isHeadless方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。