From b90617919fe53e3ad11e2b5d9593ce33cbade421 Mon Sep 17 00:00:00 2001 From: "Hugh.C" Date: Tue, 7 Jul 2020 17:59:26 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-34954=20=E5=AF=8C=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E4=B8=8A=E6=A0=87=E4=B8=8B=E6=A0=87=E5=8F=AF=E4=BB=A5=E5=90=8C?= =?UTF-8?q?=E6=97=B6=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/cell/editor/RichTextToolBar.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java b/designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java index 52a33ff12..4541ac3ba 100644 --- a/designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java +++ b/designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java @@ -256,8 +256,11 @@ public class RichTextToolBar extends BasicPane{ @Override public void actionPerformed(ActionEvent e) { boolean isSub = RichTextToolBar.this.subPane.isSelected(); - // 调用setCharacterAttributes函数设置文本区选择文本的字体 MutableAttributeSet attr = new SimpleAttributeSet(); + if (!isSub && RichTextToolBar.this.superPane.isSelected()) { + StyleConstants.setSuperscript(attr, false); + } + // 调用setCharacterAttributes函数设置文本区选择文本的字体 StyleConstants.setSubscript(attr, !isSub); setCharacterAttributes(RichTextToolBar.this.textPane, attr, false); } @@ -269,6 +272,9 @@ public class RichTextToolBar extends BasicPane{ boolean isSuper = RichTextToolBar.this.superPane.isSelected(); // 调用setCharacterAttributes函数设置文本区选择文本的字体 MutableAttributeSet attr = new SimpleAttributeSet(); + if (!isSuper && RichTextToolBar.this.subPane.isSelected()) { + StyleConstants.setSubscript(attr, false); + } StyleConstants.setSuperscript(attr, !isSuper); setCharacterAttributes(RichTextToolBar.this.textPane, attr, false); }