Java Swing Text Style getIntegerValue(Element element, Object constant)

Here you can find the source of getIntegerValue(Element element, Object constant)

Description

Gets a integer value of an attribute (e.g.

License

Open Source License

Parameter

Parameter Description
element RTF-Element
constant Constant (e.g StyleConstants.Foreground)

Return

Value, null otherwise

Declaration

public static Integer getIntegerValue(Element element, Object constant) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import javax.swing.text.AttributeSet;
import javax.swing.text.Element;

public class Main {
    /**// w w w . j av  a2  s.c  o m
     * Gets a integer value of an attribute (e.g. StyleConstants.FontFamily)
     * 
     * @param element
     *            RTF-Element
     * @param constant
     *            Constant (e.g StyleConstants.Foreground)
     * 
     * @return Value, null otherwise
     */
    public static Integer getIntegerValue(Element element, Object constant) {
        AttributeSet attributes = element.getAttributes();

        Object obj = attributes.getAttribute(constant);
        if (obj == null)
            return null;

        return (Integer) obj;
    }
}

Related

  1. createStyle(String logicalName)
  2. getBooleanValue(Element element, Object constant)
  3. getNextVisualPosition(final View v, final int pos, final Position.Bias b0, final int direction, final Position.Bias[] biasRet)
  4. hasDifferentCharacterAttributes(AttributeSet style, AttributeSet base)
  5. isCentered(AttributeSet attributes)
  6. isLTR(final int level)