Browse Source

REPORT-34954 富文本上标下标可以同时设置

feature/big-screen
Hugh.C 4 years ago
parent
commit
b90617919f
  1. 8
      designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java

8
designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java

@ -256,8 +256,11 @@ public class RichTextToolBar extends BasicPane{
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
boolean isSub = RichTextToolBar.this.subPane.isSelected(); boolean isSub = RichTextToolBar.this.subPane.isSelected();
// 调用setCharacterAttributes函数设置文本区选择文本的字体
MutableAttributeSet attr = new SimpleAttributeSet(); MutableAttributeSet attr = new SimpleAttributeSet();
if (!isSub && RichTextToolBar.this.superPane.isSelected()) {
StyleConstants.setSuperscript(attr, false);
}
// 调用setCharacterAttributes函数设置文本区选择文本的字体
StyleConstants.setSubscript(attr, !isSub); StyleConstants.setSubscript(attr, !isSub);
setCharacterAttributes(RichTextToolBar.this.textPane, attr, false); setCharacterAttributes(RichTextToolBar.this.textPane, attr, false);
} }
@ -269,6 +272,9 @@ public class RichTextToolBar extends BasicPane{
boolean isSuper = RichTextToolBar.this.superPane.isSelected(); boolean isSuper = RichTextToolBar.this.superPane.isSelected();
// 调用setCharacterAttributes函数设置文本区选择文本的字体 // 调用setCharacterAttributes函数设置文本区选择文本的字体
MutableAttributeSet attr = new SimpleAttributeSet(); MutableAttributeSet attr = new SimpleAttributeSet();
if (!isSuper && RichTextToolBar.this.subPane.isSelected()) {
StyleConstants.setSubscript(attr, false);
}
StyleConstants.setSuperscript(attr, !isSuper); StyleConstants.setSuperscript(attr, !isSuper);
setCharacterAttributes(RichTextToolBar.this.textPane, attr, false); setCharacterAttributes(RichTextToolBar.this.textPane, attr, false);
} }

Loading…
Cancel
Save