Here you can find the source of getIntegerValue(Element element, Object constant)
Parameter | Description |
---|---|
element | RTF-Element |
constant | Constant (e.g StyleConstants.Foreground) |
public static Integer getIntegerValue(Element element, Object constant)
//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; } }