Make the GUI graph fancier

This commit is contained in:
William Blake Galbreath
2020-02-02 04:00:40 -06:00
parent 196c153504
commit fa7c667a3e
6 changed files with 366 additions and 2 deletions
@@ -0,0 +1,47 @@
package com.destroystokyo.paper.gui;
import java.awt.Color;
public class GraphData {
private long total;
private long free;
private long max;
private long usedMem;
private int usedPercent;
public GraphData(long total, long free, long max) {
this.total = total;
this.free = free;
this.max = max;
this.usedMem = total - free;
this.usedPercent = usedMem == 0 ? 0 : (int) (usedMem * 100L / max);
}
public long getTotal() {
return total;
}
public long getFree() {
return free;
}
public long getMax() {
return max;
}
public long getUsedMem() {
return usedMem;
}
public int getUsedPercent() {
return usedPercent;
}
public Color getFillColor() {
return GraphColor.getFillColor(usedPercent);
}
public Color getLineColor() {
return GraphColor.getLineColor(usedPercent);
}
}