Skip to content

Commit

Permalink
Fix #27 - Change service to get initial screen size
Browse files Browse the repository at this point in the history
Toolkit.getDefaultToolkit().getScreenSize() is not especially aware of High DPI screen of the size of usable real-estate. Replaced it with GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds() to have usable values for the first layout generation.
  • Loading branch information
dullin committed Jul 4, 2024
1 parent 6451ce6 commit 03bafbc
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/rars/venus/VenusUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ a copy of this software and associated documentation files (the
* @author Sanderson and Team JSpim
**/

/* Heavily modified by Pete Sanderson, July 2004, to incorporate JSPIMMenu and JSPIMToolbar
* not as subclasses of JMenuBar and JToolBar, but as instances of them. They are both
* here primarily so both can share the Action objects.
*/
/* Heavily modified by Pete Sanderson, July 2004, to incorporate JSPIMMenu and JSPIMToolbar
* not as subclasses of JMenuBar and JToolBar, but as instances of them. They are both
* here primarily so both can share the Action objects.
*/

public class VenusUI extends JFrame {
VenusUI mainUI;
Expand Down Expand Up @@ -126,9 +126,9 @@ public VenusUI(String name, ArrayList<String> paths) {
mainUI = this;
Globals.setGui(this);
this.editor = new Editor(this);

double screenWidth = Toolkit.getDefaultToolkit().getScreenSize().getWidth();
double screenHeight = Toolkit.getDefaultToolkit().getScreenSize().getHeight();
Rectangle maximumWindowBounds = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
double screenWidth = maximumWindowBounds.getWidth();
double screenHeight = maximumWindowBounds.getHeight();
// basically give up some screen space if running at 800 x 600
double messageWidthPct = (screenWidth < 1000.0) ? 0.67 : 0.73;
double messageHeightPct = (screenWidth < 1000.0) ? 0.12 : 0.15;
Expand Down

0 comments on commit 03bafbc

Please sign in to comment.