From 90ad88ee2fbfcbac2ff6866b571bf84dc31f770e Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Tue, 1 Nov 2022 19:25:58 +0100 Subject: [PATCH] Set screen size according to system settings --- app/src/main/java/ch/nuth/zhaw/exbox/ExBoxFrame.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/src/main/java/ch/nuth/zhaw/exbox/ExBoxFrame.java b/app/src/main/java/ch/nuth/zhaw/exbox/ExBoxFrame.java index 56b1746..3a68517 100644 --- a/app/src/main/java/ch/nuth/zhaw/exbox/ExBoxFrame.java +++ b/app/src/main/java/ch/nuth/zhaw/exbox/ExBoxFrame.java @@ -29,7 +29,6 @@ import java.util.Set; * @version 2.04 2021/9/11 Test as plugin */ public class ExBoxFrame extends JFrame implements ActionListener, ItemListener { - private final int UHDTHRESHOLD = 1920; private final String STANDARDENCODING = "UTF-8"; private JMenuItem connect, exit, open, test, retest, textView, graphicView, clear; @@ -155,8 +154,7 @@ public class ExBoxFrame extends JFrame implements ActionListener, ItemListener { ex.printStackTrace(); } - Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); - double scaleFaktor = (screenSize.getWidth() <= UHDTHRESHOLD) ? 1 : 2; + double scaleFaktor = (double)Toolkit.getDefaultToolkit().getScreenResolution() / 96.0; setFontSize((int) (11 * scaleFaktor)); setSize(new Dimension((int) (400 * scaleFaktor), (int) (400 * scaleFaktor))); setTitle("ExBox");