Java源码示例:net.fs.utils.Tools
示例1
void setSpeed(int downloadSpeed, int uploadSpeed) {
config.setDownloadSpeed(downloadSpeed);
config.setUploadSpeed(uploadSpeed);
int s1 = (int) ((float) downloadSpeed * 1.1f);
text_ds.setText(" " + Tools.getSizeStringKB(s1) + "/s ");
int s2 = (int) ((float) uploadSpeed * 1.1f);
text_us.setText(" " + Tools.getSizeStringKB(s2) + "/s ");
Route.localDownloadSpeed = downloadSpeed;
Route.localUploadSpeed = config.uploadSpeed;
saveConfig();
}
示例2
public void updateUISpeed(int conn, int downloadSpeed, int uploadSpeed) {
String string =
" 下载:" + Tools.getSizeStringKB(downloadSpeed) + "/s"
+ " 上传:" + Tools.getSizeStringKB(uploadSpeed) + "/s";
if (downloadSpeedField != null) {
downloadSpeedField.setText(string);
}
}
示例3
void setSpeed(int downloadSpeed, int uploadSpeed) {
config.setDownloadSpeed(downloadSpeed);
config.setUploadSpeed(uploadSpeed);
int s1 = (int) ((float) downloadSpeed * 1.1f);
text_ds.setText(" " + Tools.getSizeStringKB(s1) + "/s ");
int s2 = (int) ((float) uploadSpeed * 1.1f);
text_us.setText(" " + Tools.getSizeStringKB(s2) + "/s ");
Route.localDownloadSpeed = downloadSpeed;
Route.localUploadSpeed = config.uploadSpeed;
saveConfig();
}
示例4
public void updateUISpeed(int conn, int downloadSpeed, int uploadSpeed) {
String string =
" 下载:" + Tools.getSizeStringKB(downloadSpeed) + "/s"
+ " 上传:" + Tools.getSizeStringKB(uploadSpeed) + "/s";
if (downloadSpeedField != null) {
downloadSpeedField.setText(string);
}
}
示例5
public void checkUpdate() {
for (int i = 0; i < 3; i++) {
checkingUpdate = true;
try {
Properties propServer = new Properties();
HttpURLConnection uc = Tools.getConnection(updateUrl);
uc.setUseCaches(false);
InputStream in = uc.getInputStream();
propServer.load(in);
serverVersion = Integer.parseInt(propServer.getProperty("version"));
break;
} catch (Exception e) {
e.printStackTrace();
try {
Thread.sleep(3 * 1000);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
} finally {
checkingUpdate = false;
}
}
if (this.haveNewVersion()) {
int option = JOptionPane.showConfirmDialog(mainFrame, "发现新版本,立即更新吗?", "提醒", JOptionPane.WARNING_MESSAGE);
if (option == JOptionPane.YES_OPTION) {
openUrl(homeUrl);
}
}
}
示例6
void setSpeed(int downloadSpeed, int uploadSpeed) {
config.setDownloadSpeed(downloadSpeed);
config.setUploadSpeed(uploadSpeed);
int s1 = (int) ((float) downloadSpeed * 1.1f);
text_ds.setText(" " + Tools.getSizeStringKB(s1) + "/s ");
int s2 = (int) ((float) uploadSpeed * 1.1f);
text_us.setText(" " + Tools.getSizeStringKB(s2) + "/s ");
Route.localDownloadSpeed = downloadSpeed;
Route.localUploadSpeed = config.uploadSpeed;
saveConfig();
}
示例7
public void updateUISpeed(int conn, int downloadSpeed, int uploadSpeed) {
String string =
" 下载:" + Tools.getSizeStringKB(downloadSpeed) + "/s"
+ " 上传:" + Tools.getSizeStringKB(uploadSpeed) + "/s";
if (downloadSpeedField != null) {
downloadSpeedField.setText(string);
}
}
示例8
public void checkUpdate() {
for (int i = 0; i < 3; i++) {
checkingUpdate = true;
try {
Properties propServer = new Properties();
HttpURLConnection uc = Tools.getConnection(updateUrl);
uc.setUseCaches(false);
InputStream in = uc.getInputStream();
propServer.load(in);
serverVersion = Integer.parseInt(propServer.getProperty("version"));
break;
} catch (Exception e) {
e.printStackTrace();
try {
Thread.sleep(3 * 1000);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
} finally {
checkingUpdate = false;
}
}
if (this.haveNewVersion()) {
int option = JOptionPane.showConfirmDialog(mainFrame, "发现新版本,立即更新吗?", "提醒", JOptionPane
.YES_NO_CANCEL_OPTION);
if (option == JOptionPane.YES_OPTION) {
openUrl(homeUrl);
}
}
}