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


Java AWTAccessor.ComponentAccessor方法代码示例

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


在下文中一共展示了AWTAccessor.ComponentAccessor方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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.
        AWTAccessor.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:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:XWindowPeer.java

示例3: 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:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:XDecoratedPeer.java

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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 than 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;
    compAccessor.setPeer(textPane, this);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:69,代码来源:XTextAreaPeer.java


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