forked from External/mage
Some more changes to GUI to better support high screen resolutions.
This commit is contained in:
parent
2e574ab19e
commit
a0ff08b0b9
13 changed files with 388 additions and 273 deletions
|
|
@ -1,14 +1,14 @@
|
|||
package mage.client.util.stats;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import javax.swing.*;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* This updates the mem usage info in the Mage client every MEM_USAGE_UPDATE_TIME ms.
|
||||
* This updates the mem usage info in the Mage client every
|
||||
* MEM_USAGE_UPDATE_TIME ms.
|
||||
*
|
||||
* @author noxx
|
||||
*/
|
||||
|
|
@ -16,9 +16,9 @@ public class UpdateMemUsageTask extends SwingWorker<Void, Float> {
|
|||
|
||||
private static final int MEM_USAGE_UPDATE_TIME = 2000;
|
||||
|
||||
private JLabel jLabelToDisplayInfo;
|
||||
private final JLabel jLabelToDisplayInfo;
|
||||
|
||||
private static final Logger logger = Logger.getLogger(UpdateMemUsageTask.class);
|
||||
private static final Logger LOGGER = Logger.getLogger(UpdateMemUsageTask.class);
|
||||
|
||||
public UpdateMemUsageTask(JLabel jLabelToDisplayInfo) {
|
||||
this.jLabelToDisplayInfo = jLabelToDisplayInfo;
|
||||
|
|
@ -28,7 +28,7 @@ public class UpdateMemUsageTask extends SwingWorker<Void, Float> {
|
|||
protected Void doInBackground() throws Exception {
|
||||
while (!isCancelled()) {
|
||||
float memUsage = MemoryUsageStatUtil.getMemoryFreeStatPercentage();
|
||||
this.publish(memUsage >= 0 ? Float.valueOf(memUsage) : null);
|
||||
this.publish(memUsage >= 0 ? memUsage : null);
|
||||
Thread.sleep(MEM_USAGE_UPDATE_TIME);
|
||||
}
|
||||
return null;
|
||||
|
|
@ -51,8 +51,9 @@ public class UpdateMemUsageTask extends SwingWorker<Void, Float> {
|
|||
try {
|
||||
get();
|
||||
} catch (InterruptedException | ExecutionException ex) {
|
||||
logger.fatal("Update Memory Usage error", ex);
|
||||
} catch (CancellationException ex) {}
|
||||
LOGGER.fatal("Update Memory Usage error", ex);
|
||||
} catch (CancellationException ex) {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue