Skip to content

Commit

Permalink
Should prevent VersionSelectWindow from growing beyond the height of …
Browse files Browse the repository at this point in the history
…the screen.
  • Loading branch information
Treer committed Apr 27, 2015
1 parent dd58f8f commit 3a51759
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/amidst/gui/version/VersionSelectWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,16 @@ public void run() {
MinecraftVersion[] localVersions = versionFactory.getLocalVersions();
String selectedProfile = Options.instance.lastProfile.get();

if (profileVersions == null) {
if ((profileVersions == null || profileVersions.length == 0) && (localVersions == null || localVersions.length == 0)) {
versionSelector.setEmptyMessage("Empty");
return;
}
for (int i = 0; i < profileVersions.length; i++)
for (int i = 0; i < profileVersions.length; i++) {
versionSelector.addVersion(new ProfileVersionComponent(profileVersions[i]));
for (int i = 0; i < localVersions.length; i++)
versionSelector.addVersion(new LocalVersionComponent(localVersions[i]));
}
for (int i = 0; i < localVersions.length; i++) {
versionSelector.addVersion(new LocalVersionComponent(localVersions[i]));
}
versionSelector.addVersion(new RemoteVersionComponent());

if (selectedProfile != null)
Expand All @@ -78,7 +80,12 @@ public void run() {
versionSelector.setEmptyMessage("Scanning...");

JScrollPane scrollPane = new JScrollPane(versionSelector);
add(scrollPane, "grow, push, h 80::");
// The preferred width should be at least a scrollbar-width wider than
// the VersionComponent's preferredSize width 500 (so 520?).
// The preferred height should allow the dialog to fit easily on a 720p
// display, while being nicely divisible by VersionComponent's height
// of 40 (so 520 again then?).
add(scrollPane, "grow, push, w :520:, h 80:520:");
pack();
setLocation(200, 200);
setVisible(true);
Expand Down

0 comments on commit 3a51759

Please sign in to comment.