I'm having a problem with a widget i've made by extending a widget. when added to my window the text shows up and the background colour changes but the bar its self does not update or change no matter what i do. Running SVN version of FengGUI. If anyone can help that would be great.
Heres the offending class:
public class StatusBar extends ProgressBar {
private int maxval;
private float currentval;
public StatusBar(String text) {
super(text);
this.setHorizontal(true);
this.setMinSize(140, 13);
this.setSize(140,13);
this.getAppearance().add(new PlainBackground(Color.BLACK));
this.getAppearance().getData().setColor(Color.WHITE);
this.setValue(0.5);
}
public void setColor(Color col) {
((EntryAppearance)this.getAppearance()).setSelectionColor(col);
}
public void setMax(int max) {
maxval = max;
}
public boolean maxSet() {
if (maxval > 0) {
return true;
}
return false;
}
public void updateCurrent(float current) {
if (maxSet()) {
if (currentval != current) {
currentval = current;
this.setValue(currentval / maxval);
}
}
}
}
The class is used for displaying a healthbar with a max health and a current health. Its impleamented as follows:
StatusBar health = new StatusBar("Health");
health.setColor(Color.GREEN);
health.setMax(100);
health.updateCurrent(100);
window.addWidget(health);
//when the health changes
health.updateCurrent(99);