public static int checkAlignment(JTextPane pane)
	{
		AttributeSet attributes = pane.getParagraphAttributes();

		if (attributes.isDefined(StyleConstants.Alignment))
		{
			Integer align = (Integer) attributes
					.getAttribute(StyleConstants.Alignment);
			return align.intValue();
		}

		if (attributes.isDefined(CSS.Attribute.TEXT_ALIGN))
		{
			String s = attributes.getAttribute(CSS.Attribute.TEXT_ALIGN)
					.toString();

			for (int alignment = 0; alignment < ALIGNMENT_NAMES.length; alignment++)
			{
				if (ALIGNMENT_NAMES[alignment].equalsIgnoreCase(s))
				{
					return alignment;
				}
			}
		}
		return -1; // Not aligned.
	}