title: How do I set both StrikeThrough and Underline styling options for text inside a JTextPane?
body: <p>I have a JTextPane component and I am trying to style the text that will be typed by the user to be both underline and strikethrough at the same time.</p>
  
  <p>The relevant snippet of code that that should set the strikethrough attribute of the next typed character to true is this:</p>
  
  <pre><code>JEditorPane editor = getEditor(e);
  if (editor != null) {
       StyledEditorKit kit = getStyledEditorKit(editor);
       MutableAttributeSet attr = kit.getInputAttributes();            
       SimpleAttributeSet sas = new SimpleAttributeSet();
       StyleConstants.setStrikeThrough(sas, true);                
       setCharacterAttributes(editor, sas, false);
  }
  </code></pre>
  
  <p>This does style the text as strikethrough, but if it was already styled as underline, it loses the underline styling information. Taking a close look at the actual code behind StyleConstants.setStrikeThrough(...) I have noticed that the CSS styling tag for both underline and strikethrough attributes will be the same (i.e. "text-decoration") and when the value is updated in the hashtable holding the attributes, it will be overriden. </p>
  
  <p>This means that code like:</p>
  
  <pre><code>StyleConstants.setStrikeThrough(sas, true);
  StyleConstants.setUnderlineThrough(sas, true);
  </code></pre>
  
  <p>will result in the next typed character being underlined without a strikethrough. I've checked the attribute values and for the "text-decoration" attribute the value is "underline", whereas I was expecting "line-through,underline".</p>
  
  <p>Does anyone know how to achieve this in a clean Swing compliant way? Is there something wrong in my approach? Is there an underlying assumption at the core of JTextPane styling that text should not be strikethrough and underline at the same time?</p>