All Downloads are FREE. Search and download functionalities are using the official Maven repository.

mmb.content.electric.ElectricalBatteryVisualiser Maven / Gradle / Ivy

Go to download

Dependency for the MultiMachineBuilder, a voxel game about building an industrial empire in a finite world. THIS RELEASE IS NOT PLAYABLE. To play the game, donwload from >ITCH.IO LINK HERE< or >GH releases link here<

There is a newer version: 0.6
Show newest version
/**
 * 
 */
package mmb.content.electric;

import java.awt.Graphics;

import javax.swing.JProgressBar;

/**
 * @author oskar
 *
 */
public class ElectricalBatteryVisualiser extends JProgressBar {
	public ElectricalBatteryVisualiser() {
	}
	private static final long serialVersionUID = -822042501287883479L;
	private Battery battery;
	/** @return battery currently visualised */
	public Battery getBattery() {
		return battery;
	}
	/** @param battery new battery to visualise */
	public void setBattery(Battery battery) {
		this.battery = battery;
		repaint();
	}
	@Override
	public void paint(@SuppressWarnings("null") Graphics g) {
		if(battery != null) {
			setMaximum((int) battery.capacity);
			setMinimum(0);
			setValue((int) battery.stored);
		}
		super.paint(g);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy