Fix scaling for linux devices
This commit is contained in:
parent
ff0c3f0b98
commit
25068543ad
1 changed files with 314 additions and 303 deletions
|
@ -29,6 +29,7 @@ import java.util.Set;
|
||||||
* @version 2.04 2021/9/11 Test as plugin
|
* @version 2.04 2021/9/11 Test as plugin
|
||||||
*/
|
*/
|
||||||
public class ExBoxFrame extends JFrame implements ActionListener, ItemListener {
|
public class ExBoxFrame extends JFrame implements ActionListener, ItemListener {
|
||||||
|
private final Dimension UHDTHRESHOLD = new Dimension(2000, 1500);
|
||||||
private final String STANDARDENCODING = "UTF-8";
|
private final String STANDARDENCODING = "UTF-8";
|
||||||
|
|
||||||
private JMenuItem connect, exit, open, test, retest, textView, graphicView, clear;
|
private JMenuItem connect, exit, open, test, retest, textView, graphicView, clear;
|
||||||
|
@ -154,8 +155,18 @@ public class ExBoxFrame extends JFrame implements ActionListener, ItemListener {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
setFontSize(11);
|
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
|
||||||
setSize(new Dimension(400, 400));
|
|
||||||
|
double scale = (
|
||||||
|
screenSize.getWidth() > UHDTHRESHOLD.getWidth() &&
|
||||||
|
screenSize.getHeight() > UHDTHRESHOLD.getHeight()) ? 2 : 1;
|
||||||
|
|
||||||
|
scale = Math.max(scale, Toolkit.getDefaultToolkit().getScreenResolution() / 96.0);
|
||||||
|
setFontSize((int) (11 * scale));
|
||||||
|
|
||||||
|
setSize(
|
||||||
|
new Dimension((int)(400 * scale), (int)(400 * scale)));
|
||||||
|
|
||||||
setTitle("ExBox");
|
setTitle("ExBox");
|
||||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
initComponents();
|
initComponents();
|
||||||
|
|
Loading…
Reference in a new issue