Example #1
0
 @Override
 public void actionPerformed(ActionEvent e) {
   JEditorPane editor = getEditor(e);
   if (editor != null) {
     StyledEditorKit kit = getStyledEditorKit(editor);
     MutableAttributeSet attr = kit.getInputAttributes();
     isUnderline = (StyleConstants.isUnderline(attr)) ? false : true;
     SimpleAttributeSet sas = new SimpleAttributeSet();
     StyleConstants.setUnderline(sas, isUnderline);
     setCharacterAttributes(editor, sas, false);
     boolean isEnabling = (StyleConstants.isBold(attr)) ? false : true;
     Integer position = getCursorPosition();
     if (editor != null
         && editor.getSelectedText() != null
         && editor.getSelectedText().length() > 0)
       controller.sendStyleChangeRequest(
           currentDocID,
           StyleChange.StyleType.UNDERLINE,
           isEnabling,
           position,
           editor.getSelectedText().length());
     updateDocToDataModel();
   }
 }
Example #2
0
 @Override
 public void read(Reader in, Document doc, int pos) throws IOException, BadLocationException {
   Debug.log(3, "SikuliEditorKit.read");
   super.read(in, doc, pos);
 }