From d8f99774674ced5aef35f768c99ffd6a5cd6fb46 Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 6 Nov 2019 11:53:37 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-23246=20=E8=AE=BE=E8=AE=A1=E5=99=A8UI=20?= =?UTF-8?q?=E6=8F=92=E5=85=A5=E6=96=9C=E7=BA=BF=E6=98=BE=E7=A4=BA=E4=B8=8D?= =?UTF-8?q?=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/utils/gui/FineDesignScreen.java | 36 +++++++++++++++++++ .../editor/BiasTextPainterCellEditor.java | 5 +-- 2 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/utils/gui/FineDesignScreen.java diff --git a/designer-base/src/main/java/com/fr/design/utils/gui/FineDesignScreen.java b/designer-base/src/main/java/com/fr/design/utils/gui/FineDesignScreen.java new file mode 100644 index 0000000000..13fca5aa5a --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/utils/gui/FineDesignScreen.java @@ -0,0 +1,36 @@ +package com.fr.design.utils.gui; + +import com.fr.stable.os.OperatingSystem; + +import java.awt.*; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2019/10/29 + */ +public enum FineDesignScreen { + + /** + * 一个临界dpi + * 设计器(windows/linux)大于等于该dpi界面ui变得很小 (jdk bug 在jdk9修复: http://openjdk.java.net/jeps/263) + */ + DPI_144(144); + + private int value; + + FineDesignScreen(int value) { + this.value = value; + } + + /** + * 判断win/linux下的dpi macos不做处理 + * @return + */ + public static boolean isHighDPI() { + if (OperatingSystem.isMacos()) { + return false; + } + return Toolkit.getDefaultToolkit().getScreenResolution() >= DPI_144.value; + } +} diff --git a/designer-realize/src/main/java/com/fr/design/cell/editor/BiasTextPainterCellEditor.java b/designer-realize/src/main/java/com/fr/design/cell/editor/BiasTextPainterCellEditor.java index 85b602c42f..ab737812f8 100644 --- a/designer-realize/src/main/java/com/fr/design/cell/editor/BiasTextPainterCellEditor.java +++ b/designer-realize/src/main/java/com/fr/design/cell/editor/BiasTextPainterCellEditor.java @@ -10,6 +10,7 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextarea.UITextArea; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.ElementCasePane; +import com.fr.design.utils.gui.FineDesignScreen; import com.fr.general.ComparatorUtils; import com.fr.grid.Grid; import com.fr.report.cell.TemplateCellElement; @@ -35,7 +36,7 @@ import java.awt.event.ActionListener; public class BiasTextPainterCellEditor extends AbstractCellEditor { private BiasTextPainterPane biasTextPainterPane = null; - private static final double MULTIPLE = 1.5; + private static final double MULTIPLE = FineDesignScreen.isHighDPI() ? 2 : 1.5; /** * Constructor. @@ -114,7 +115,7 @@ public class BiasTextPainterCellEditor extends AbstractCellEditor { //center JPanel centerPane =FRGUIPaneFactory.createBorderLayout_S_Pane(); - defaultPane.add(centerPane, BorderLayout.CENTER); + defaultPane.add(centerPane, BorderLayout.NORTH); //text JPanel textPane = FRGUIPaneFactory.createBorderLayout_S_Pane();