Extracted the codes about installing

This commit is contained in:
huanghongxun
2015-12-11 21:15:56 +08:00
parent 78c46aeb64
commit d052442aea
14 changed files with 545 additions and 1049 deletions

View File

@@ -69,9 +69,9 @@ public class SwingUtils {
*
* @param link
*/
public static void openLink(URI link) {
public static void openLink(String link) {
try {
java.awt.Desktop.getDesktop().browse(link);
java.awt.Desktop.getDesktop().browse(new URI(link));
} catch (Throwable e) {
HMCLog.warn("Failed to open link: " + link, e);
}
@@ -138,7 +138,6 @@ public class SwingUtils {
DefaultTableModel model = (DefaultTableModel) table.getModel();
while (model.getRowCount() > 0)
model.removeRow(0);
table.updateUI();
return model;
}

View File

@@ -69,16 +69,6 @@ public final class Utils {
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(text), null);
}
public static boolean openLink(String url) {
try {
Desktop.getDesktop().browse(new URI(url));
return true;
} catch (Exception ex) {
HMCLog.warn("Failed to open link:" + url, ex);
return false;
}
}
public static void openFolder(File f) {
try {
f.mkdirs();

View File

@@ -29,6 +29,7 @@ import org.jackhuang.hellominecraft.utils.functions.NonFunction;
import org.jackhuang.hellominecraft.utils.DoubleOutputStream;
import org.jackhuang.hellominecraft.utils.LauncherPrintStream;
import org.jackhuang.hellominecraft.utils.LogWindowOutputStream;
import org.jackhuang.hellominecraft.utils.SwingUtils;
import org.jackhuang.hellominecraft.utils.Utils;
/**
@@ -224,15 +225,15 @@ public class LogWindow extends javax.swing.JFrame {
}//GEN-LAST:event_btnCopyActionPerformed
private void btnMCBBSActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMCBBSActionPerformed
Utils.openLink(C.URL_PUBLISH);
SwingUtils.openLink(C.URL_PUBLISH);
}//GEN-LAST:event_btnMCBBSActionPerformed
private void btnTieBaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnTieBaActionPerformed
Utils.openLink(C.URL_TIEBA);
SwingUtils.openLink(C.URL_TIEBA);
}//GEN-LAST:event_btnTieBaActionPerformed
private void btnMCFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMCFActionPerformed
Utils.openLink(C.URL_MINECRAFTFORUM);
SwingUtils.openLink(C.URL_MINECRAFTFORUM);
}//GEN-LAST:event_btnMCFActionPerformed
private void btnTerminateGameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnTerminateGameActionPerformed
@@ -241,7 +242,7 @@ public class LogWindow extends javax.swing.JFrame {
}//GEN-LAST:event_btnTerminateGameActionPerformed
private void btnGitHubActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGitHubActionPerformed
Utils.openLink(C.URL_GITHUB);
SwingUtils.openLink(C.URL_GITHUB);
}//GEN-LAST:event_btnGitHubActionPerformed
public void log(String status) {