All pastes #912083 Raw Edit

Something

public text v1 · immutable
·published 2008-02-21 03:20 UTC
rendered paste body
Inserting some red text

inputfield.getDocument().insert(0, "my text", redAttributeSet);


Send the text to the server

Element root = inputfield.getDocument().getDefaultRootElement();

for(Element child :root.getElements())
   int start = child.startoffset
   int end = child.endoffset
   AttributeSet attributes = child.getAttributes()
   for(AttributeSet attribute : attributes)
         if(attribute.hasforegroundcolor)
            text = jerklib.getColorCode(color) + inputfield.getDocument().getText(start, end)