当前位置: 首页>>代码示例>>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;未经允许,请勿转载。