当前位置: 首页>>代码示例>>Java>>正文


Java AWTAccessor.getComponentAccessor方法代码示例

本文整理汇总了Java中sun.awt.AWTAccessor.getComponentAccessor方法的典型用法代码示例。如果您正苦于以下问题:Java AWTAccessor.getComponentAccessor方法的具体用法?Java AWTAccessor.getComponentAccessor怎么用?Java AWTAccessor.getComponentAccessor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sun.awt.AWTAccessor的用法示例。


在下文中一共展示了AWTAccessor.getComponentAccessor方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCapableCursor

import sun.awt.AWTAccessor; //导入方法依赖的package包/类
private Cursor getCapableCursor(Component comp) {
    AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();

    Component c = comp;
    while ((c != null) && !(c instanceof Window)
           && compAccessor.isEnabled(c)
           && compAccessor.isVisible(c)
           && compAccessor.isDisplayable(c))
    {
        c = compAccessor.getParent(c);
    }
    if (c instanceof Window) {
        return (compAccessor.isEnabled(c)
                && compAccessor.isVisible(c)
                && compAccessor.isDisplayable(c)
                && compAccessor.isEnabled(comp))
               ?
                compAccessor.getCursor(comp)
               :
                Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
    } else if (c == null) {
        return null;
    }
    return getCapableCursor(compAccessor.getParent(c));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:XGlobalCursorManager.java

示例2: repositionSecurityWarning

import sun.awt.AWTAccessor; //导入方法依赖的package包/类
public void repositionSecurityWarning() {
    // NOTE: On KWin if the window/border snapping option is enabled,
    // the Java window may be swinging while it's being moved.
    // This doesn't make the application unusable though looks quite ugly.
    // Probobly we need to find some hint to assign to our Security
    // Warning window in order to exclude it from the snapping option.
    // We are not currently aware of existance of such a property.
    if (warningWindow != null) {
        // We can't use the coordinates stored in the XBaseWindow since
        // they are zeros for decorated frames.
        ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
        int x = compAccessor.getX(target);
        int y = compAccessor.getY(target);
        int width = compAccessor.getWidth(target);
        int height = compAccessor.getHeight(target);
        warningWindow.reposition(x, y, width, height);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:XWindowPeer.java

示例3: setForegroundForHierarchy

import sun.awt.AWTAccessor; //导入方法依赖的package包/类
private void setForegroundForHierarchy(Container cont, Color c) {
    synchronized(target.getTreeLock()) {
        final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
        int n = cont.getComponentCount();
        for(int i=0; i < n; i++) {
            Component comp = cont.getComponent(i);
            Color color = comp.getForeground();
            if (color == null || color.equals(c)) {
                ComponentPeer cpeer = acc.getPeer(comp);
                if (cpeer != null) {
                    cpeer.setForeground(c);
                }
                if (cpeer instanceof LightweightPeer
                    && comp instanceof Container)
                {
                    setForegroundForHierarchy((Container) comp, c);
                }
            }
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:XPanelPeer.java

示例4: recursivelySetIcon

import sun.awt.AWTAccessor; //导入方法依赖的package包/类
public void recursivelySetIcon(java.util.List<IconInfo> icons) {
    dumpIcons(winAttr.icons);
    setIconHints(icons);
    Window target = (Window)this.target;
    Window[] children = target.getOwnedWindows();
    int cnt = children.length;
    final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
    for (int i = 0; i < cnt; i++) {
        final ComponentPeer childPeer = acc.getPeer(children[i]);
        if (childPeer != null && childPeer instanceof XWindowPeer) {
            if (((XWindowPeer)childPeer).winAttr.iconsInherited) {
                ((XWindowPeer)childPeer).winAttr.icons = icons;
                ((XWindowPeer)childPeer).recursivelySetIcon(icons);
            }
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:XWindowPeer.java

示例5: dumpTarget

import sun.awt.AWTAccessor; //导入方法依赖的package包/类
final void dumpTarget() {
    AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
    int getWidth = compAccessor.getWidth((Component)target);
    int getHeight = compAccessor.getHeight((Component)target);
    int getTargetX = compAccessor.getX((Component)target);
    int getTargetY = compAccessor.getY((Component)target);
    System.err.println(">>> Target: " + getTargetX + ", " + getTargetY + ", " + getWidth + ", " + getHeight);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:XDecoratedPeer.java

示例6: initTextField

import sun.awt.AWTAccessor; //导入方法依赖的package包/类
void initTextField() {
    setVisible(target.isVisible());

    setBounds(x, y, width, height, SET_BOUNDS);

    AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
    foreground = compAccessor.getForeground(target);
    if (foreground == null)
        foreground = SystemColor.textText;

    setForeground(foreground);

    background = compAccessor.getBackground(target);
    if (background == null) {
        if (((TextField)target).isEditable()) background = SystemColor.text;
        else background = SystemColor.control;
    }
    setBackground(background);

    if (!target.isBackgroundSet()) {
        // This is a way to set the background color of the TextArea
        // without calling setBackground - go through accessor
        compAccessor.setBackground(target, background);
    }
    if (!target.isForegroundSet()) {
        target.setForeground(SystemColor.textText);
    }

    setFont(font);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:31,代码来源:XTextFieldPeer.java

示例7: getGraphics

import sun.awt.AWTAccessor; //导入方法依赖的package包/类
public Graphics getGraphics() {
    AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
    return getGraphics(content.surfaceData,
                       compAccessor.getForeground(target),
                       compAccessor.getBackground(target),
                       compAccessor.getFont(target));
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:8,代码来源:XDecoratedPeer.java

示例8: test

import sun.awt.AWTAccessor; //导入方法依赖的package包/类
private static void test(final Applet applet) {
    ComponentAccessor acc = AWTAccessor.getComponentAccessor();
    for (int i = 1; i < 10; ++i) {
        for (final BufferCapabilities caps : bcs) {
            try {
                acc.createBufferStrategy(applet, i, caps);
            } catch (final AWTException ignored) {
                // this kind of buffer strategy is not supported
            }
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:AppletFlipBuffer.java

示例9: showDocumentProperties

import sun.awt.AWTAccessor; //导入方法依赖的package包/类
public PrintRequestAttributeSet
    showDocumentProperties(Window owner,
                           PrintService service,
                           PrintRequestAttributeSet aset)
{
    try {
        setNativePrintServiceIfNeeded(service.getName());
    } catch (PrinterException e) {
    }
    final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
    long hWnd = acc.<WComponentPeer>getPeer(owner).getHWnd();
    DevModeValues info = new DevModeValues();
    getDevModeValues(aset, info);
    boolean ok =
        showDocProperties(hWnd, aset,
                          info.dmFields,
                          info.copies,
                          info.collate,
                          info.color,
                          info.duplex,
                          info.orient,
                          info.paper,
                          info.bin,
                          info.xres_quality,
                          info.yres);

    if (ok) {
        return aset;
    } else {
        return null;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:33,代码来源:WPrinterJob.java

示例10: dispatchKeyEvent

import sun.awt.AWTAccessor; //导入方法依赖的package包/类
public boolean dispatchKeyEvent(KeyEvent keyEvent) {
    int id = keyEvent.getID();
    int keyCode = keyEvent.getKeyCode();

    if (id == KeyEvent.KEY_PRESSED && keyCode == KeyEvent.VK_ESCAPE) {
        synchronized (target.getTreeLock()) {
            Component comp = (Component) keyEvent.getSource();
            while (comp != null) {
                // Fix for 6240084 Disposing a file dialog when the drop-down is active does not dispose the dropdown menu, on Xtoolkit
                // See also 6259493
                ComponentAccessor acc = AWTAccessor.getComponentAccessor();
                if (comp == pathChoice) {
                    XChoicePeer choicePeer = acc.getPeer(pathChoice);
                    if (choicePeer.isUnfurled()){
                        return false;
                    }
                }
                Object peer = acc.getPeer(comp);
                if (peer == this) {
                    handleCancel();
                    return true;
                }
                comp = comp.getParent();
            }
        }
    }

    return false;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:30,代码来源:XFileDialogPeer.java

示例11: dumpTarget

import sun.awt.AWTAccessor; //导入方法依赖的package包/类
final void dumpTarget() {
    AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
    int getWidth = compAccessor.getWidth(target);
    int getHeight = compAccessor.getHeight(target);
    int getTargetX = compAccessor.getX(target);
    int getTargetY = compAccessor.getY(target);
    System.err.println(">>> Target: " + getTargetX + ", " + getTargetY + ", " + getWidth + ", " + getHeight);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:XDecoratedPeer.java

示例12: XTextAreaPeer

import sun.awt.AWTAccessor; //导入方法依赖的package包/类
/**
 * Create a Text area.
 */
XTextAreaPeer(TextArea target) {
    super(target);

    // some initializations require that target be set even
    // though init(target) has not been called
    this.target = target;

    //ComponentAccessor.enableEvents(target,AWTEvent.MOUSE_WHEEL_EVENT_MASK);

    String text = target.getText();
    jtext = new AWTTextArea(text, this);
    jtext.setWrapStyleWord(true);
    jtext.getDocument().addDocumentListener(jtext);
    XToolkit.specialPeerMap.put(jtext,this);
    textPane = new AWTTextPane(jtext,this, target.getParent());

    setBounds(x, y, width, height, SET_BOUNDS);
    textPane.setVisible(true);
    textPane.validate();

    AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
    foreground = compAccessor.getForeground(target);
    if (foreground == null)  {
        foreground = SystemColor.textText;
    }
    setForeground(foreground);

    background = compAccessor.getBackground(target);
    if (background == null) {
        if (target.isEditable()) background = SystemColor.text;
        else background = SystemColor.control;
    }
    setBackground(background);

    if (!target.isBackgroundSet()) {
        // This is a way to set the background color of the TextArea
        // without calling setBackground - go through accessor
        compAccessor.setBackground(target, background);
    }
    if (!target.isForegroundSet()) {
        target.setForeground(SystemColor.textText);
    }

    setFont(font);

    // set the text of this object to the text of its target
    setTextImpl(target.getText());  //?? should this be setText

    int start = target.getSelectionStart();
    int end = target.getSelectionEnd();
    // Fix for 5100200
    // Restoring Motif behaviour
    // Since the end position of the selected text can be greater then the length of the text,
    // so we should set caret to max position of the text
    setCaretPosition(Math.min(end, text.length()));
    if (end > start) {
        // Should be called after setText() and setCaretPosition()
        select(start, end);
    }
    setEditable(target.isEditable());
    setScrollBarVisibility();
    // After this line we should not change the component's text
    firstChangeSkipped = true;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:68,代码来源:XTextAreaPeer.java

示例13: setCurrentFocusOwner

import sun.awt.AWTAccessor; //导入方法依赖的package包/类
@Override
public void setCurrentFocusOwner(Component comp) {
    final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
    setNativeFocusOwner(comp != null ? acc.getPeer(comp) : null);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:6,代码来源:WKeyboardFocusManagerPeer.java

示例14: initAcceleratedSurface

import sun.awt.AWTAccessor; //导入方法依赖的package包/类
/**
 * Create a FBO-based SurfaceData object (or init the backbuffer
 * of an existing window if this is a double buffered GraphicsConfig)
 */
protected SurfaceData initAcceleratedSurface() {
    SurfaceData sData;
    Component comp = vImg.getComponent();
    final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
    X11ComponentPeer peer = (comp != null) ? acc.getPeer(comp) : null;

    try {
        boolean createVSynced = false;
        boolean forceback = false;
        if (context instanceof Boolean) {
            forceback = ((Boolean)context).booleanValue();
            if (forceback && peer instanceof BackBufferCapsProvider) {
                BackBufferCapsProvider provider =
                    (BackBufferCapsProvider)peer;
                BufferCapabilities caps = provider.getBackBufferCaps();
                if (caps instanceof ExtendedBufferCapabilities) {
                    ExtendedBufferCapabilities ebc =
                        (ExtendedBufferCapabilities)caps;
                    if (ebc.getVSync() == VSYNC_ON &&
                        ebc.getFlipContents() == COPIED)
                    {
                        createVSynced = true;
                        forceback = false;
                    }
                }
            }
        }

        if (forceback) {
            // peer must be non-null in this case
            sData = GLXSurfaceData.createData(peer, vImg, FLIP_BACKBUFFER);
        } else {
            GLXGraphicsConfig gc =
                (GLXGraphicsConfig)vImg.getGraphicsConfig();
            ColorModel cm = gc.getColorModel(vImg.getTransparency());
            int type = vImg.getForcedAccelSurfaceType();
            // if acceleration type is forced (type != UNDEFINED) then
            // use the forced type, otherwise choose FBOBJECT
            if (type == OGLSurfaceData.UNDEFINED) {
                type = OGLSurfaceData.FBOBJECT;
            }
            if (createVSynced) {
                sData = GLXSurfaceData.createData(peer, vImg, type);
            } else {
                sData = GLXSurfaceData.createData(gc,
                                                  vImg.getWidth(),
                                                  vImg.getHeight(),
                                                  cm, vImg, type);
            }
        }
    } catch (NullPointerException ex) {
        sData = null;
    } catch (OutOfMemoryError er) {
        sData = null;
    }

    return sData;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:63,代码来源:GLXVolatileSurfaceManager.java


注:本文中的sun.awt.AWTAccessor.getComponentAccessor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。