java.awt.font.TextAttribute#RUN_DIRECTION_RTL源码实例Demo

下面列出了java.awt.font.TextAttribute#RUN_DIRECTION_RTL 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: jdk8u_jdk   文件: AttributeValues.java
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();
    }
}
 
源代码2 项目: dragonwell8_jdk   文件: AttributeValues.java
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();
    }
}
 
源代码3 项目: jdk8u-jdk   文件: AttributeValues.java
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();
    }
}
 
源代码4 项目: dragonwell8_jdk   文件: JTextComponent.java
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 );
}
 
源代码5 项目: Bytecoder   文件: JTextComponent.java
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 );
}
 
源代码6 项目: Java8CN   文件: JTextComponent.java
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 );
}
 
源代码7 项目: openjdk-8-source   文件: JTextComponent.java
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 );
}
 
源代码8 项目: jdk8u-jdk   文件: AttributeValues.java
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();
    }
}
 
源代码9 项目: openjdk-jdk8u   文件: AttributeValues.java
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();
    }
}
 
源代码10 项目: openjdk-jdk8u-backup   文件: AttributeValues.java
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();
    }
}
 
源代码11 项目: jdk8u-jdk   文件: JTextComponent.java
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 );
}
 
源代码12 项目: Bytecoder   文件: AttributeValues.java
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();
    }
}
 
源代码13 项目: jdk8u-jdk   文件: JTextComponent.java
/**
 * 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);
    }
}
 
源代码14 项目: TencentKona-8   文件: JTextComponent.java
/**
 * 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);
    }
}
 
源代码15 项目: jdk8u-dev-jdk   文件: JTextComponent.java
/**
 * 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);
    }
}
 
源代码16 项目: openjdk-jdk9   文件: JTextComponent.java
/**
 * 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);
    }
}
 
源代码17 项目: JDKSourceCode1.8   文件: JTextComponent.java
/**
 * 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);
    }
}
 
源代码18 项目: openjdk-jdk8u   文件: JTextComponent.java
/**
 * 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);
    }
}
 
源代码19 项目: openjdk-8-source   文件: JTextComponent.java
/**
 * 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);
    }
}
 
源代码20 项目: openjdk-jdk8u-backup   文件: JTextComponent.java
/**
 * 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);
    }
}