Java examples for javax.swing.text:AttributeSet
Swing AttributeSet to String
//package com.java2s; import java.util.Enumeration; import javax.swing.text.AttributeSet; public class Main { public static String toString(AttributeSet a) { StringBuilder builder = new StringBuilder("["); Enumeration en = a.getAttributeNames(); do {/* ww w . j ava2 s . com*/ if (!en.hasMoreElements()) { break; } Object name = en.nextElement(); builder.append(name).append("=").append(a.getAttribute(name)); if (en.hasMoreElements()) { builder.append(", "); } } while (true); builder.append("]"); return builder.toString(); } }