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


Java TextAttribute.RUN_DIRECTION_RTL属性代码示例

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


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

示例1: i_get

private Object i_get(EAttribute a) {
    switch (a) {
    case EFAMILY: return family;
    case EWEIGHT: return Float.valueOf(weight);
    case EWIDTH: return Float.valueOf(width);
    case EPOSTURE: return Float.valueOf(posture);
    case ESIZE: return Float.valueOf(size);
    case ETRANSFORM:
        return transform == null
            ? TransformAttribute.IDENTITY
            : new TransformAttribute(transform);
    case ESUPERSCRIPT: return Integer.valueOf(superscript);
    case EFONT: return font;
    case ECHAR_REPLACEMENT: return charReplacement;
    case EFOREGROUND: return foreground;
    case EBACKGROUND: return background;
    case EUNDERLINE: return Integer.valueOf(underline);
    case ESTRIKETHROUGH: return Boolean.valueOf(strikethrough);
    case ERUN_DIRECTION: {
        switch (runDirection) {
            // todo: figure out a way to indicate this value
            // case -1: return Integer.valueOf(runDirection);
        case 0: return TextAttribute.RUN_DIRECTION_LTR;
        case 1: return TextAttribute.RUN_DIRECTION_RTL;
        default: return null;
        }
    } // not reachable
    case EBIDI_EMBEDDING: return Integer.valueOf(bidiEmbedding);
    case EJUSTIFICATION: return Float.valueOf(justification);
    case EINPUT_METHOD_HIGHLIGHT: return imHighlight;
    case EINPUT_METHOD_UNDERLINE: return Integer.valueOf(imUnderline);
    case ESWAP_COLORS: return Boolean.valueOf(swapColors);
    case ENUMERIC_SHAPING: return numericShaping;
    case EKERNING: return Integer.valueOf(kerning);
    case ELIGATURES: return Integer.valueOf(ligatures);
    case ETRACKING: return Float.valueOf(tracking);
    default: throw new InternalError();
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:39,代码来源:AttributeValues.java

示例2: setComponentOrientation

public void setComponentOrientation( ComponentOrientation o ) {
    // Set the document's run direction property to match the
    // ComponentOrientation property.
    Document doc = getDocument();
    if( doc !=  null ) {
        Boolean runDir = o.isLeftToRight()
                         ? TextAttribute.RUN_DIRECTION_LTR
                         : TextAttribute.RUN_DIRECTION_RTL;
        doc.putProperty( TextAttribute.RUN_DIRECTION, runDir );
    }
    super.setComponentOrientation( o );
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:JTextComponent.java

示例3: setDocument

/**
 * Associates the editor with a text document.
 * The currently registered factory is used to build a view for
 * the document, which gets displayed by the editor after revalidation.
 * A PropertyChange event ("document") is propagated to each listener.
 *
 * @param doc  the document to display/edit
 * @see #getDocument
 * @beaninfo
 *  description: the text document model
 *        bound: true
 *       expert: true
 */
public void setDocument(Document doc) {
    Document old = model;

    /*
     * acquire a read lock on the old model to prevent notification of
     * mutations while we disconnecting the old model.
     */
    try {
        if (old instanceof AbstractDocument) {
            ((AbstractDocument)old).readLock();
        }
        if (accessibleContext != null) {
            model.removeDocumentListener(
                ((AccessibleJTextComponent)accessibleContext));
        }
        if (inputMethodRequestsHandler != null) {
            model.removeDocumentListener((DocumentListener)inputMethodRequestsHandler);
        }
        model = doc;

        // Set the document's run direction property to match the
        // component's ComponentOrientation property.
        Boolean runDir = getComponentOrientation().isLeftToRight()
                         ? TextAttribute.RUN_DIRECTION_LTR
                         : TextAttribute.RUN_DIRECTION_RTL;
        if (runDir != doc.getProperty(TextAttribute.RUN_DIRECTION)) {
            doc.putProperty(TextAttribute.RUN_DIRECTION, runDir );
        }
        firePropertyChange("document", old, doc);
    } finally {
        if (old instanceof AbstractDocument) {
            ((AbstractDocument)old).readUnlock();
        }
    }

    revalidate();
    repaint();
    if (accessibleContext != null) {
        model.addDocumentListener(
            ((AccessibleJTextComponent)accessibleContext));
    }
    if (inputMethodRequestsHandler != null) {
        model.addDocumentListener((DocumentListener)inputMethodRequestsHandler);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:58,代码来源:JTextComponent.java

示例4: setDocument

/**
 * Associates the editor with a text document.
 * The currently registered factory is used to build a view for
 * the document, which gets displayed by the editor after revalidation.
 * A PropertyChange event ("document") is propagated to each listener.
 *
 * @param doc  the document to display/edit
 * @see #getDocument
 */
@BeanProperty(expert = true, description
        = "the text document model")
public void setDocument(Document doc) {
    Document old = model;

    /*
     * acquire a read lock on the old model to prevent notification of
     * mutations while we disconnecting the old model.
     */
    try {
        if (old instanceof AbstractDocument) {
            ((AbstractDocument)old).readLock();
        }
        if (accessibleContext != null) {
            model.removeDocumentListener(
                ((AccessibleJTextComponent)accessibleContext));
        }
        if (inputMethodRequestsHandler != null) {
            model.removeDocumentListener((DocumentListener)inputMethodRequestsHandler);
        }
        model = doc;

        // Set the document's run direction property to match the
        // component's ComponentOrientation property.
        Boolean runDir = getComponentOrientation().isLeftToRight()
                         ? TextAttribute.RUN_DIRECTION_LTR
                         : TextAttribute.RUN_DIRECTION_RTL;
        if (runDir != doc.getProperty(TextAttribute.RUN_DIRECTION)) {
            doc.putProperty(TextAttribute.RUN_DIRECTION, runDir );
        }
        firePropertyChange("document", old, doc);
    } finally {
        if (old instanceof AbstractDocument) {
            ((AbstractDocument)old).readUnlock();
        }
    }

    revalidate();
    repaint();
    if (accessibleContext != null) {
        model.addDocumentListener(
            ((AccessibleJTextComponent)accessibleContext));
    }
    if (inputMethodRequestsHandler != null) {
        model.addDocumentListener((DocumentListener)inputMethodRequestsHandler);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:56,代码来源:JTextComponent.java


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