Skip to content

Commit

Permalink
working on catching instances where the screen is smaller than the re…
Browse files Browse the repository at this point in the history
…qeusted window size, which in some versions of java results in a 0x0 size window
  • Loading branch information
ESIC-DA committed Oct 18, 2019
1 parent 1443110 commit 1fbb3fb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<property name="build.numThreads" value="1" />
<property name="src.dir" value="./src"/>
<property name="lib.dir" value="./deps/org.graphstream/lib"/>
<property name="build.version" value="AHA-GUI v0.7.0b1"/>
<property name="build.version" value="AHA-GUI v0.7.0b2"/>
<property name="CP" value="."/>
<tstamp>
<format property="TODAY" pattern="yyyy-MM-dd HH:mm" />
Expand Down
6 changes: 5 additions & 1 deletion src/esic/AHAGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class AHAGUI extends JFrame
private java.util.Vector<JMenuItem> defaultTrue=new java.util.Vector<>(), defaultFalse=new java.util.Vector<>();
private Properties m_props;

protected static java.awt.Dimension s_preferredTotalSize=new java.awt.Dimension(1400, 800); //store the preferred size so if they open a new file we keep that size
protected static java.awt.Dimension s_preferredTotalSize=new java.awt.Dimension(1920, 1200); //TODO: make this a pref
public final static String s_settingsFileName="AHAGUI.settings";

@SuppressWarnings("deprecation") //we have to use the old'n'busted version here for java8 compatibility
Expand All @@ -53,8 +53,12 @@ public AHAGUI(AHAModel model, AHAController controller, boolean useMultiLineGrap
addWindowListener(m_controller);

pack(); //populate all the info about the insets
java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
if (screenSize.width < s_preferredTotalSize.width) { s_preferredTotalSize.width=screenSize.width; System.out.println("Screen size limits width. Changing width to "+screenSize.width); }
if (screenSize.height-40 < s_preferredTotalSize.height) { s_preferredTotalSize.height=screenSize.height-40; System.out.println("Screen size limits height. Changing height to "+(screenSize.height-40));}
setSize(s_preferredTotalSize);
setPreferredSize(s_preferredTotalSize);
setMinimumSize(new java.awt.Dimension(800,600));
String title="AHA-GUI";
try { title=AHAGUI.class.getPackage().getImplementationVersion().split(" B")[0]; } catch (Exception e) {}
setTitle(title); //This should result in something like "AHA-GUI v0.5.6b1" being displayed
Expand Down

0 comments on commit 1fbb3fb

Please sign in to comment.