类sun.awt.ComponentFactory源码实例Demo

下面列出了怎么用sun.awt.ComponentFactory的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: openjdk-jdk9   文件: PointerInfoCrashTest.java
private static void testMouseInfoPeer() {
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    if (toolkit instanceof ComponentFactory) {
        ComponentFactory componentFactory = (ComponentFactory) toolkit;

        MouseInfoPeer mouseInfoPeer = componentFactory.getMouseInfoPeer();
        mouseInfoPeer.fillPointWithCoords(new Point());

        Window win = new Window(null);
        win.setSize(300, 300);
        win.setVisible(true);

        mouseInfoPeer.isWindowUnderMouse(win);
        win.dispose();
    }
}
 
源代码2 项目: jdk1.8-source-analysis   文件: Robot.java
private void init(GraphicsDevice screen) throws AWTException {
    checkRobotAllowed();
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    if (toolkit instanceof ComponentFactory) {
        peer = ((ComponentFactory)toolkit).createRobot(this, screen);
        disposer = new RobotDisposer(peer);
        sun.java2d.Disposer.addRecord(anchor, disposer);
    }
    initLegalButtonMask();
}
 
源代码3 项目: dragonwell8_jdk   文件: Robot.java
private void init(GraphicsDevice screen) throws AWTException {
    checkRobotAllowed();
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    if (toolkit instanceof ComponentFactory) {
        peer = ((ComponentFactory)toolkit).createRobot(this, screen);
        disposer = new RobotDisposer(peer);
        sun.java2d.Disposer.addRecord(anchor, disposer);
    }
    initLegalButtonMask();
}
 
源代码4 项目: TencentKona-8   文件: Robot.java
private void init(GraphicsDevice screen) throws AWTException {
    checkRobotAllowed();
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    if (toolkit instanceof ComponentFactory) {
        peer = ((ComponentFactory)toolkit).createRobot(this, screen);
        disposer = new RobotDisposer(peer);
        sun.java2d.Disposer.addRecord(anchor, disposer);
    }
    initLegalButtonMask();
}
 
源代码5 项目: jdk8u60   文件: Robot.java
private void init(GraphicsDevice screen) throws AWTException {
    checkRobotAllowed();
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    if (toolkit instanceof ComponentFactory) {
        peer = ((ComponentFactory)toolkit).createRobot(this, screen);
        disposer = new RobotDisposer(peer);
        sun.java2d.Disposer.addRecord(anchor, disposer);
    }
    initLegalButtonMask();
}
 
源代码6 项目: JDKSourceCode1.8   文件: Robot.java
private void init(GraphicsDevice screen) throws AWTException {
    checkRobotAllowed();
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    if (toolkit instanceof ComponentFactory) {
        peer = ((ComponentFactory)toolkit).createRobot(this, screen);
        disposer = new RobotDisposer(peer);
        sun.java2d.Disposer.addRecord(anchor, disposer);
    }
    initLegalButtonMask();
}
 
源代码7 项目: openjdk-jdk8u   文件: Robot.java
private void init(GraphicsDevice screen) throws AWTException {
    checkRobotAllowed();
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    if (toolkit instanceof ComponentFactory) {
        peer = ((ComponentFactory)toolkit).createRobot(this, screen);
        disposer = new RobotDisposer(peer);
        sun.java2d.Disposer.addRecord(anchor, disposer);
    }
    initLegalButtonMask();
}
 
源代码8 项目: openjdk-jdk8u-backup   文件: Robot.java
private void init(GraphicsDevice screen) throws AWTException {
    checkRobotAllowed();
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    if (toolkit instanceof ComponentFactory) {
        peer = ((ComponentFactory)toolkit).createRobot(this, screen);
        disposer = new RobotDisposer(peer);
        sun.java2d.Disposer.addRecord(anchor, disposer);
    }
    initLegalButtonMask();
}
 
源代码9 项目: Bytecoder   文件: MenuComponent.java
final ComponentFactory getComponentFactory() {
    final Toolkit toolkit = Toolkit.getDefaultToolkit();
    if (toolkit instanceof ComponentFactory) {
        return (ComponentFactory) toolkit;
    }
    throw new AWTError("UI components are unsupported by: " + toolkit);
}
 
源代码10 项目: Bytecoder   文件: Robot.java
private void init(GraphicsDevice screen) throws AWTException {
    checkRobotAllowed();
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    if (toolkit instanceof ComponentFactory) {
        peer = ((ComponentFactory)toolkit).createRobot(this, screen);
    }
    initLegalButtonMask();
}
 
源代码11 项目: Bytecoder   文件: MouseInfo.java
/**
 * Returns a {@code PointerInfo} instance that represents the current
 * location of the mouse pointer.
 * The {@code GraphicsDevice} stored in this {@code PointerInfo}
 * contains the mouse pointer. The coordinate system used for the mouse position
 * depends on whether or not the {@code GraphicsDevice} is part of a virtual
 * screen device.
 * For virtual screen devices, the coordinates are given in the virtual
 * coordinate system, otherwise they are returned in the coordinate system
 * of the {@code GraphicsDevice}. See {@link GraphicsConfiguration}
 * for more information about the virtual screen devices.
 * On systems without a mouse, returns {@code null}.
 * <p>
 * If there is a security manager, its {@code checkPermission} method
 * is called with an {@code AWTPermission("watchMousePointer")}
 * permission before creating and returning a {@code PointerInfo}
 * object. This may result in a {@code SecurityException}.
 *
 * @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true
 * @exception SecurityException if a security manager exists and its
 *            {@code checkPermission} method doesn't allow the operation
 * @see       GraphicsConfiguration
 * @see       SecurityManager#checkPermission
 * @see       java.awt.AWTPermission
 * @return    location of the mouse pointer
 * @since     1.5
 */
public static PointerInfo getPointerInfo() throws HeadlessException {
    if (GraphicsEnvironment.isHeadless()) {
        throw new HeadlessException();
    }

    SecurityManager security = System.getSecurityManager();
    if (security != null) {
        security.checkPermission(AWTPermissions.WATCH_MOUSE_PERMISSION);
    }

    Toolkit toolkit = Toolkit.getDefaultToolkit();
    Point point = new Point(0, 0);
    int deviceNum = 0;
    if (toolkit instanceof ComponentFactory) {
        deviceNum = ((ComponentFactory) toolkit).getMouseInfoPeer().fillPointWithCoords(point);
    }

    GraphicsDevice[] gds = GraphicsEnvironment.getLocalGraphicsEnvironment().
                               getScreenDevices();
    PointerInfo retval = null;
    if (areScreenDevicesIndependent(gds)) {
        retval = new PointerInfo(gds[deviceNum], point);
    } else {
        for (int i = 0; i < gds.length; i++) {
            GraphicsConfiguration gc = gds[i].getDefaultConfiguration();
            Rectangle bounds = gc.getBounds();
            if (bounds.contains(point)) {
                retval = new PointerInfo(gds[i], point);
            }
        }
    }

    return retval;
}
 
源代码12 项目: Bytecoder   文件: Font.java
/**
 * Gets the peer of this {@code Font}.
 *
 * @return the peer of the {@code Font}.
 */
private FontPeer getFontPeer() {
    if(peer == null) {
        Toolkit tk = Toolkit.getDefaultToolkit();
        if (tk instanceof ComponentFactory) {
            peer = ((ComponentFactory) tk).getFontPeer(name, style);
        }
    }
    return peer;
}
 
源代码13 项目: openjdk-jdk9   文件: MenuComponent.java
final ComponentFactory getComponentFactory() {
    final Toolkit toolkit = Toolkit.getDefaultToolkit();
    if (toolkit instanceof ComponentFactory) {
        return (ComponentFactory) toolkit;
    }
    throw new AWTError("UI components are unsupported by: " + toolkit);
}
 
源代码14 项目: openjdk-jdk9   文件: Robot.java
private void init(GraphicsDevice screen) throws AWTException {
    checkRobotAllowed();
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    if (toolkit instanceof ComponentFactory) {
        peer = ((ComponentFactory)toolkit).createRobot(this, screen);
        disposer = new RobotDisposer(peer);
        sun.java2d.Disposer.addRecord(anchor, disposer);
    }
    initLegalButtonMask();
}
 
源代码15 项目: openjdk-jdk9   文件: MouseInfo.java
/**
 * Returns a {@code PointerInfo} instance that represents the current
 * location of the mouse pointer.
 * The {@code GraphicsDevice} stored in this {@code PointerInfo}
 * contains the mouse pointer. The coordinate system used for the mouse position
 * depends on whether or not the {@code GraphicsDevice} is part of a virtual
 * screen device.
 * For virtual screen devices, the coordinates are given in the virtual
 * coordinate system, otherwise they are returned in the coordinate system
 * of the {@code GraphicsDevice}. See {@link GraphicsConfiguration}
 * for more information about the virtual screen devices.
 * On systems without a mouse, returns {@code null}.
 * <p>
 * If there is a security manager, its {@code checkPermission} method
 * is called with an {@code AWTPermission("watchMousePointer")}
 * permission before creating and returning a {@code PointerInfo}
 * object. This may result in a {@code SecurityException}.
 *
 * @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true
 * @exception SecurityException if a security manager exists and its
 *            {@code checkPermission} method doesn't allow the operation
 * @see       GraphicsConfiguration
 * @see       SecurityManager#checkPermission
 * @see       java.awt.AWTPermission
 * @return    location of the mouse pointer
 * @since     1.5
 */
public static PointerInfo getPointerInfo() throws HeadlessException {
    if (GraphicsEnvironment.isHeadless()) {
        throw new HeadlessException();
    }

    SecurityManager security = System.getSecurityManager();
    if (security != null) {
        security.checkPermission(AWTPermissions.WATCH_MOUSE_PERMISSION);
    }

    Toolkit toolkit = Toolkit.getDefaultToolkit();
    Point point = new Point(0, 0);
    int deviceNum = 0;
    if (toolkit instanceof ComponentFactory) {
        deviceNum = ((ComponentFactory) toolkit).getMouseInfoPeer().fillPointWithCoords(point);
    }

    GraphicsDevice[] gds = GraphicsEnvironment.getLocalGraphicsEnvironment().
                               getScreenDevices();
    PointerInfo retval = null;
    if (areScreenDevicesIndependent(gds)) {
        retval = new PointerInfo(gds[deviceNum], point);
    } else {
        for (int i = 0; i < gds.length; i++) {
            GraphicsConfiguration gc = gds[i].getDefaultConfiguration();
            Rectangle bounds = gc.getBounds();
            if (bounds.contains(point)) {
                retval = new PointerInfo(gds[i], point);
            }
        }
    }

    return retval;
}
 
源代码16 项目: openjdk-jdk9   文件: Font.java
/**
 * Gets the peer of this {@code Font}.
 *
 * @return the peer of the {@code Font}.
 */
private FontPeer getFontPeer() {
    if(peer == null) {
        Toolkit tk = Toolkit.getDefaultToolkit();
        if (tk instanceof ComponentFactory) {
            peer = ((ComponentFactory) tk).getFontPeer(name, style);
        }
    }
    return peer;
}
 
源代码17 项目: jdk8u-jdk   文件: Robot.java
private void init(GraphicsDevice screen) throws AWTException {
    checkRobotAllowed();
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    if (toolkit instanceof ComponentFactory) {
        peer = ((ComponentFactory)toolkit).createRobot(this, screen);
        disposer = new RobotDisposer(peer);
        sun.java2d.Disposer.addRecord(anchor, disposer);
    }
    initLegalButtonMask();
}
 
源代码18 项目: Java8CN   文件: Robot.java
private void init(GraphicsDevice screen) throws AWTException {
    checkRobotAllowed();
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    if (toolkit instanceof ComponentFactory) {
        peer = ((ComponentFactory)toolkit).createRobot(this, screen);
        disposer = new RobotDisposer(peer);
        sun.java2d.Disposer.addRecord(anchor, disposer);
    }
    initLegalButtonMask();
}
 
源代码19 项目: hottub   文件: Robot.java
private void init(GraphicsDevice screen) throws AWTException {
    checkRobotAllowed();
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    if (toolkit instanceof ComponentFactory) {
        peer = ((ComponentFactory)toolkit).createRobot(this, screen);
        disposer = new RobotDisposer(peer);
        sun.java2d.Disposer.addRecord(anchor, disposer);
    }
    initLegalButtonMask();
}
 
源代码20 项目: openjdk-8-source   文件: Robot.java
private void init(GraphicsDevice screen) throws AWTException {
    checkRobotAllowed();
    gdLoc = screen.getDefaultConfiguration().getBounds().getLocation();
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    if (toolkit instanceof ComponentFactory) {
        peer = ((ComponentFactory)toolkit).createRobot(this, screen);
        disposer = new RobotDisposer(peer);
        sun.java2d.Disposer.addRecord(anchor, disposer);
    }
    initLegalButtonMask();
}
 
源代码21 项目: openjdk-8   文件: Robot.java
private void init(GraphicsDevice screen) throws AWTException {
    checkRobotAllowed();
    gdLoc = screen.getDefaultConfiguration().getBounds().getLocation();
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    if (toolkit instanceof ComponentFactory) {
        peer = ((ComponentFactory)toolkit).createRobot(this, screen);
        disposer = new RobotDisposer(peer);
        sun.java2d.Disposer.addRecord(anchor, disposer);
    }
    initLegalButtonMask();
}
 
源代码22 项目: jdk8u_jdk   文件: Robot.java
private void init(GraphicsDevice screen) throws AWTException {
    checkRobotAllowed();
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    if (toolkit instanceof ComponentFactory) {
        peer = ((ComponentFactory)toolkit).createRobot(this, screen);
        disposer = new RobotDisposer(peer);
        sun.java2d.Disposer.addRecord(anchor, disposer);
    }
    initLegalButtonMask();
}
 
源代码23 项目: jdk8u-jdk   文件: Robot.java
private void init(GraphicsDevice screen) throws AWTException {
    checkRobotAllowed();
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    if (toolkit instanceof ComponentFactory) {
        peer = ((ComponentFactory)toolkit).createRobot(this, screen);
        disposer = new RobotDisposer(peer);
        sun.java2d.Disposer.addRecord(anchor, disposer);
    }
    initLegalButtonMask();
}
 
源代码24 项目: jdk-1.7-annotated   文件: Robot.java
private void init(GraphicsDevice screen) throws AWTException {
    checkRobotAllowed();
    gdLoc = screen.getDefaultConfiguration().getBounds().getLocation();
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    if (toolkit instanceof ComponentFactory) {
        peer = ((ComponentFactory)toolkit).createRobot(this, screen);
        disposer = new RobotDisposer(peer);
        sun.java2d.Disposer.addRecord(anchor, disposer);
    }
    initLegalButtonMask();
}
 
源代码25 项目: jdk8u-dev-jdk   文件: Robot.java
private void init(GraphicsDevice screen) throws AWTException {
    checkRobotAllowed();
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    if (toolkit instanceof ComponentFactory) {
        peer = ((ComponentFactory)toolkit).createRobot(this, screen);
        disposer = new RobotDisposer(peer);
        sun.java2d.Disposer.addRecord(anchor, disposer);
    }
    initLegalButtonMask();
}
 
源代码26 项目: dragonwell8_jdk   文件: DataTransferer.java
/**
 * The accessor method for the singleton DataTransferer instance. Note
 * that in a headless environment, there may be no DataTransferer instance;
 * instead, null will be returned.
 */
public static synchronized DataTransferer getInstance() {
    return ((ComponentFactory) Toolkit.getDefaultToolkit()).getDataTransferer();
}
 
源代码27 项目: TencentKona-8   文件: DataTransferer.java
/**
 * The accessor method for the singleton DataTransferer instance. Note
 * that in a headless environment, there may be no DataTransferer instance;
 * instead, null will be returned.
 */
public static synchronized DataTransferer getInstance() {
    return ((ComponentFactory) Toolkit.getDefaultToolkit()).getDataTransferer();
}
 
源代码28 项目: jdk8u60   文件: DataTransferer.java
/**
 * The accessor method for the singleton DataTransferer instance. Note
 * that in a headless environment, there may be no DataTransferer instance;
 * instead, null will be returned.
 */
public static synchronized DataTransferer getInstance() {
    return ((ComponentFactory) Toolkit.getDefaultToolkit()).getDataTransferer();
}
 
源代码29 项目: openjdk-jdk8u   文件: DataTransferer.java
/**
 * The accessor method for the singleton DataTransferer instance. Note
 * that in a headless environment, there may be no DataTransferer instance;
 * instead, null will be returned.
 */
public static synchronized DataTransferer getInstance() {
    return ((ComponentFactory) Toolkit.getDefaultToolkit()).getDataTransferer();
}
 
源代码30 项目: openjdk-jdk8u-backup   文件: DataTransferer.java
/**
 * The accessor method for the singleton DataTransferer instance. Note
 * that in a headless environment, there may be no DataTransferer instance;
 * instead, null will be returned.
 */
public static synchronized DataTransferer getInstance() {
    return ((ComponentFactory) Toolkit.getDefaultToolkit()).getDataTransferer();
}
 
 类所在包
 类方法
 同包方法