-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added cancel button to pack download dialog; cancel or closing dialog…
… aborts download
- Loading branch information
1 parent
a6d92de
commit 8612734
Showing
2 changed files
with
24 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,6 @@ | |
import static com.google.common.net.HttpHeaders.CONTENT_MD5; | ||
import static net.ftb.download.Locations.MODPACKS; | ||
import static net.ftb.download.Locations.PRIVATEPACKS; | ||
|
||
import net.ftb.data.ModPack; | ||
import net.ftb.data.Settings; | ||
import net.ftb.gui.LaunchFrame; | ||
|
@@ -33,6 +32,8 @@ | |
import net.ftb.util.OSUtils; | ||
import net.ftb.util.TrackerUtils; | ||
|
||
import java.awt.event.ActionEvent; | ||
import java.awt.event.ActionListener; | ||
import java.awt.event.WindowAdapter; | ||
import java.awt.event.WindowEvent; | ||
import java.io.BufferedInputStream; | ||
|
@@ -313,8 +314,9 @@ public ModManager (JFrame owner, Boolean model) { | |
super(owner, model); | ||
setResizable(false); | ||
setTitle("Downloading..."); | ||
setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); | ||
setBounds(100, 100, 313, 138); | ||
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
FyberOptic
Author
Contributor
|
||
setBounds(100, 100, 313, 165); | ||
setLocationRelativeTo(null); | ||
contentPane = new JPanel(); | ||
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); | ||
setContentPane(contentPane); | ||
|
@@ -332,8 +334,26 @@ public ModManager (JFrame owner, Boolean model) { | |
label.setHorizontalAlignment(SwingConstants.CENTER); | ||
label.setBounds(0, 42, 313, 14); | ||
contentPane.add(label); | ||
|
||
JButton cancelButton = new JButton(); | ||
cancelButton.setText("Cancel"); | ||
cancelButton.setBounds(50, 100, 200, 30); | ||
final ModManager thisManager = this; | ||
cancelButton.addActionListener(new ActionListener() { | ||
@Override | ||
public void actionPerformed(ActionEvent arg0) { | ||
thisManager.dispatchEvent(new WindowEvent(thisManager, WindowEvent.WINDOW_CLOSING)); | ||
} | ||
}); | ||
contentPane.add(cancelButton); | ||
|
||
addWindowListener(new WindowAdapter() { | ||
@Override | ||
public void windowClosing(WindowEvent e) { | ||
worker.cancel(true); | ||
super.windowClosing(e); | ||
} | ||
|
||
@Override | ||
public void windowOpened (WindowEvent arg0) { | ||
worker = new ModManagerWorker() { | ||
|
DISPOSE_ON_CLOSE is probably correct one. Launcher creates always new JDialog.
Otherwise looking good but we probably need check if mopack is always left state which launcher can detect and start reinstalling at next launch. I can do testing later and try to find bad cases.