From 4a8407499bd226b42e337d11b2a184ac7f27b242 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Mon, 11 Sep 2017 14:39:49 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-4492=20alphafine=20=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E9=A2=84=E8=A7=88=E7=95=8C=E9=9D=A2=E6=9C=89=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E7=9A=84=E8=BE=B9=E6=A1=86=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../preview/DocumentPreviewPane.java | 31 ++++--------- .../fr/design/gui/itextarea/UITextArea.java | 44 ++++++++++--------- 2 files changed, 32 insertions(+), 43 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/alphafine/preview/DocumentPreviewPane.java b/designer/src/com/fr/design/mainframe/alphafine/preview/DocumentPreviewPane.java index ed96fbed91..0fbfe4a2d8 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/preview/DocumentPreviewPane.java +++ b/designer/src/com/fr/design/mainframe/alphafine/preview/DocumentPreviewPane.java @@ -3,7 +3,6 @@ package com.fr.design.mainframe.alphafine.preview; import com.fr.design.gui.itextarea.UITextArea; import com.fr.design.mainframe.alphafine.AlphaFineConstants; -import com.fr.design.utils.gui.GUICoreUtils; import javax.swing.*; import java.awt.*; @@ -15,31 +14,19 @@ public class DocumentPreviewPane extends JPanel { public DocumentPreviewPane(String title, String summary) { this.setLayout(new BorderLayout()); - this.setBackground(Color.WHITE); + this.setPreferredSize(new Dimension(AlphaFineConstants.RIGHT_WIDTH, AlphaFineConstants.CONTENT_HEIGHT)); + this.setBackground(Color.white); UITextArea titleArea = new UITextArea(title); - UITextArea contentArea = new UITextArea(summary); - titleArea.setOpaque(false); - contentArea.setOpaque(false); - titleArea.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + titleArea.setBorder(null); + titleArea.setEditable(false); titleArea.setForeground(AlphaFineConstants.BLUE); - contentArea.setForeground(AlphaFineConstants.BLACK); - titleArea.setPreferredSize(new Dimension(360, 30)); titleArea.setFont(AlphaFineConstants.LARGE_FONT); - contentArea.setFont(AlphaFineConstants.MEDIUM_FONT); add(titleArea, BorderLayout.NORTH); + UITextArea contentArea = new UITextArea(summary); + contentArea.setEditable(false); + contentArea.setBorder(null); + contentArea.setForeground(AlphaFineConstants.BLACK); + contentArea.setFont(AlphaFineConstants.MEDIUM_FONT); add(contentArea, BorderLayout.CENTER); } - - - public static void main(String[] args) { - JFrame jf = new JFrame("test"); - jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - JPanel content = (JPanel) jf.getContentPane(); - content.setLayout(null); - - content.add(new DocumentPreviewPane("test", "ababababaabbababab")); - GUICoreUtils.centerWindow(jf); - jf.setSize(400, 400); - jf.setVisible(true); - } } diff --git a/designer_base/src/com/fr/design/gui/itextarea/UITextArea.java b/designer_base/src/com/fr/design/gui/itextarea/UITextArea.java index 94ecdc3d7d..ede8be5932 100644 --- a/designer_base/src/com/fr/design/gui/itextarea/UITextArea.java +++ b/designer_base/src/com/fr/design/gui/itextarea/UITextArea.java @@ -20,11 +20,6 @@ public class UITextArea extends JTextArea implements UIObserver { initComponents(); } - @Override - public Insets getInsets() { - return new Insets(5, 5, 5, 5); - } - public UITextArea() { super(); InputEventBaseOnOS.addBasicEditInputMap(this); @@ -37,6 +32,26 @@ public class UITextArea extends JTextArea implements UIObserver { initComponents(); } + /** + * @param args + */ + public static void main(String... args) { +// JFrame jf = new JFrame("test"); +// jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); +// JPanel content = (JPanel) jf.getContentPane(); +// content.setLayout(new BorderLayout()); +// UITextArea bb = new UITextArea("123455weoijweio reiwj kewl jfejkfljds kl jfldk jfk jdskfjkdsfklj dkl jfsdjf"); +// content.add(bb, BorderLayout.CENTER); +// GUICoreUtils.centerWindow(jf); +// jf.setSize(400, 400); +// jf.setVisible(true); + } + + @Override + public Insets getInsets() { + return new Insets(5, 5, 5, 5); + } + private void initComponents() { setLineWrap(true); setWrapStyleWord(true); @@ -100,7 +115,9 @@ public class UITextArea extends JTextArea implements UIObserver { @Override protected void paintBorder(Graphics g) { - getUI().paintBorder((Graphics2D) g, getWidth(), getHeight(), true, Constants.NULL); + if (getBorder() != null) { + getUI().paintBorder((Graphics2D) g, getWidth(), getHeight(), true, Constants.NULL); + } } @Override @@ -117,19 +134,4 @@ public class UITextArea extends JTextArea implements UIObserver { public boolean shouldResponseChangeListener() { return true; } - - /** - * @param args - */ - public static void main(String... args) { -// JFrame jf = new JFrame("test"); -// jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); -// JPanel content = (JPanel) jf.getContentPane(); -// content.setLayout(new BorderLayout()); -// UITextArea bb = new UITextArea("123455weoijweio reiwj kewl jfejkfljds kl jfldk jfk jdskfjkdsfklj dkl jfsdjf"); -// content.add(bb, BorderLayout.CENTER); -// GUICoreUtils.centerWindow(jf); -// jf.setSize(400, 400); -// jf.setVisible(true); - } } \ No newline at end of file