diff --git a/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/BubbleHint.java b/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/BubbleHint.java index 56f978731b..79d49d1925 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/BubbleHint.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/BubbleHint.java @@ -17,6 +17,7 @@ import java.awt.event.ActionListener; public class BubbleHint extends Bubble { private UIButton confirmButton; + private static final Color CONTENT_TEXT_COLOR = new Color(51, 51, 52); public BubbleHint() { super(TailDirection.TOP, 0.9f); @@ -38,21 +39,21 @@ public class BubbleHint extends Bubble { title.setHorizontalAlignment(SwingConstants.CENTER); title.setBorder(BorderFactory.createEmptyBorder(0,0,5,0)); - UILabel content1 = new UILabel(Toolkit.i18nText("Fine-Design_Guide_Tips_Content1")); - content1.setPreferredSize(new Dimension(190,20)); - content1.setHorizontalAlignment(SwingConstants.CENTER); + UILabel content1 = createContentLabel(Toolkit.i18nText("Fine-Design_Guide_Tips_Content1")); - UILabel content2 = new UILabel(Toolkit.i18nText("Fine-Design_Guide_Tips_Content2")); - content2.setPreferredSize(new Dimension(190,20)); - content2.setHorizontalAlignment(SwingConstants.CENTER); + UILabel content2 = createContentLabel(Toolkit.i18nText("Fine-Design_Guide_Tips_Content2")); JPanel buttonContainer= FRGUIPaneFactory.createCenterFlowZeroGapBorderPane(); - buttonContainer.setBorder(BorderFactory.createEmptyBorder(20, 0, 0, 0)); + buttonContainer.setBorder(BorderFactory.createEmptyBorder(15, 0, 0, 0)); buttonContainer.setPreferredSize(new Dimension(190,40)); buttonContainer.setOpaque(false); - confirmButton = new UIButton(Toolkit.i18nText("Fine-Design_Guide_Tips_Know")); - confirmButton.setPreferredSize(new Dimension(78, 24)); + confirmButton = new UIButton(Toolkit.i18nText("Fine-Design_Guide_Tips_Know")) { + public Dimension getPreferredSize() { + return new Dimension(78, 24); + } + }; + buttonContainer.add(confirmButton); contentPane.add(title); @@ -71,4 +72,13 @@ public class BubbleHint extends Bubble { confirmButton.removeActionListener(listener); } + private UILabel createContentLabel(String text) { + UILabel content = new UILabel(text); + content.setPreferredSize(new Dimension(190,20)); + content.setHorizontalAlignment(SwingConstants.CENTER); + content.setFont(content.getFont().deriveFont(14.0f)); + content.setForeground(CONTENT_TEXT_COLOR); + return content; + } + } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/ExpandPane.java b/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/ExpandPane.java index c71a15ea7d..c4e6e01601 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/ExpandPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/ExpandPane.java @@ -30,7 +30,7 @@ public class ExpandPane extends JPanel { } private void initComponent() { - VerticalFlowLayout layout = new VerticalFlowLayout(VerticalFlowLayout.TOP, 10, 5); + VerticalFlowLayout layout = new VerticalFlowLayout(VerticalFlowLayout.TOP, 10, 0); layout.setAlignLeft(true); this.setLayout(layout); @@ -47,7 +47,7 @@ public class ExpandPane extends JPanel { private JPanel createHeader() { headerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - headerPane.setPreferredSize(new Dimension(200, 24)); + headerPane.setPreferredSize(new Dimension(200, 16)); UILabel headerTitle = new UILabel(this.title); headerTitle.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); arrow = new UILabel(downIcon); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideCompleteDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideCompleteDialog.java index 29316652da..af1854d7af 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideCompleteDialog.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideCompleteDialog.java @@ -14,7 +14,9 @@ import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.JDialog; import javax.swing.JPanel; +import javax.swing.JTextPane; import javax.swing.SwingConstants; +import javax.swing.text.MutableAttributeSet; import javax.swing.text.SimpleAttributeSet; import javax.swing.text.StyleConstants; import javax.swing.text.StyledDocument; @@ -22,6 +24,7 @@ import java.awt.BorderLayout; import java.awt.Color; import java.awt.Container; import java.awt.Dimension; +import java.awt.Font; import java.awt.Graphics2D; import java.awt.Window; import java.awt.event.ActionEvent; @@ -34,12 +37,16 @@ public class GuideCompleteDialog extends JDialog { private static final int ICON_HEIGHT = 182; private static final Color FONT_COLOR = new Color(51, 51, 52); private static final Color BUTTON_BG_COLOR = new Color(65, 155,249); + private static final Font TITLE_FONT = new Font(Font.SANS_SERIF, Font.BOLD, 22); + private static final Font CONTENT_FONT = new Font(Font.SANS_SERIF, Font.PLAIN, 18); + private static final Font BUTTON_FONT = new Font(Font.SANS_SERIF, Font.BOLD, 14); private static GuideCompleteDialog dialog; public static GuideCompleteDialog getInstance() { if (dialog == null) { dialog = new GuideCompleteDialog(DesignerContext.getDesignerFrame()); } + dialog = new GuideCompleteDialog(DesignerContext.getDesignerFrame()); return dialog; } @@ -65,15 +72,16 @@ public class GuideCompleteDialog extends JDialog { container.setBorder(BorderFactory.createEmptyBorder(15, 52, 25, 52)); UILabel title = new UILabel(Toolkit.i18nText("Fine-Design_Guide_Complete_Confirm")); - title.setFont(title.getFont().deriveFont(22.0f)); + title.setFont(TITLE_FONT); title.setPreferredSize(new Dimension(190, 30)); title.setHorizontalAlignment(SwingConstants.CENTER); title.setForeground(FONT_COLOR); textArea = new UITextPane(); + changeLineSpacing(textArea, 0.19f,false); textArea.setEnabled(false); textArea.setOpaque(false); - textArea.setFont(textArea.getFont().deriveFont(18.0f)); + textArea.setFont(CONTENT_FONT); textArea.setPreferredSize(new Dimension(236, 52)); textArea.setBorder(null); textArea.setDisabledTextColor(FONT_COLOR); @@ -83,7 +91,8 @@ public class GuideCompleteDialog extends JDialog { doc.setParagraphAttributes(0, doc.getLength(), center, false); JPanel buttonContainer= FRGUIPaneFactory.createCenterFlowZeroGapBorderPane(); - buttonContainer.setPreferredSize(new Dimension(190,38)); + buttonContainer.setPreferredSize(new Dimension(190,43)); + buttonContainer.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); buttonContainer.setOpaque(false); UIButton button = new UIButton(Toolkit.i18nText("Fine-Design_Guide_Complete_End")){ @@ -92,6 +101,7 @@ public class GuideCompleteDialog extends JDialog { return new Dimension(122, 38); } }; + button.setFont(BUTTON_FONT); button.setUI(confirmButtonUI); button.setRoundBorder(true); button.setForeground(Color.WHITE); @@ -131,4 +141,11 @@ public class GuideCompleteDialog extends JDialog { } } }; + + private void changeLineSpacing(JTextPane pane, float factor, boolean replace) { + pane.selectAll(); + MutableAttributeSet set = new SimpleAttributeSet(pane.getParagraphAttributes()); + StyleConstants.setLineSpacing(set, factor); + pane.setParagraphAttributes(set, replace); + } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideManageDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideManageDialog.java index 07059ad052..98ea4c3c6d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideManageDialog.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideManageDialog.java @@ -74,7 +74,7 @@ public class GuideManageDialog extends JDialog { } private JPanel createGuideVersionPane(GuideVersion guideVersion) { - JPanel expandContent = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, VerticalFlowLayout.TOP, 0, 5); + JPanel expandContent = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, VerticalFlowLayout.TOP, 0, 10); for (GuideGroup guideGroup : guideVersion.getGuideGroupList()) { JPanel guideGroupCard = createGuideGroupCard(guideGroup); expandContent.add(guideGroupCard); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/bubble/BubbleWithClose.java b/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/bubble/BubbleWithClose.java index 904185ccb3..62e0ed65d0 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/bubble/BubbleWithClose.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/bubble/BubbleWithClose.java @@ -164,22 +164,23 @@ public class BubbleWithClose extends Bubble { return new Insets(lineSpace / 2 - 1, 0, lineSpace / 2, 0); } }; - changeLineSpacing(textArea, (float) lineSpace / 2 / lineHeight, true); - textArea.setText(str); + textArea.setFont(font); + changeLineSpacing(textArea, lineHeight, true); textArea.setEditable(false); textArea.setForeground(foreground); textArea.setDisabledTextColor(foreground); textArea.setBorder(null); - textArea.setFont(font); textArea.setOpaque(false); + textArea.setText(str); highlightText(textArea); return textArea; } - private void changeLineSpacing(JTextPane pane, float factor, boolean replace) { + private void changeLineSpacing(JTextPane pane, int lineHeight, boolean replace) { pane.selectAll(); MutableAttributeSet set = new SimpleAttributeSet(pane.getParagraphAttributes()); - StyleConstants.setLineSpacing(set, factor); + FontMetrics fontMetrics = GraphHelper.getFontMetrics(pane.getFont()); + StyleConstants.setLineSpacing(set, (float)(lineHeight - fontMetrics.getHeight()) / fontMetrics.getHeight()); pane.setParagraphAttributes(set, replace); }