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

mdlaf.components.progressbar.MaterialProgressBarUI Maven / Gradle / Ivy

There is a newer version: 1.1.4
Show newest version
package mdlaf.components.progressbar;

import mdlaf.utils.MaterialDrawingUtils;

import javax.swing.*;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicProgressBarUI;
import java.awt.*;

/**
 * @author https://github.com/vincenzopalazzo
 */
public class MaterialProgressBarUI extends BasicProgressBarUI {

	public static ComponentUI createUI (JComponent c) {
		return new MaterialProgressBarUI ();
	}

	@Override
	public void installUI (JComponent c) {
		super.installUI (c);

		JProgressBar progressBar = (JProgressBar) c;
		progressBar.setBorder (UIManager.getBorder("ProgressBar.border"));
		progressBar.setBackground (UIManager.getColor("ProgressBar.background"));
		progressBar.setForeground (UIManager.getColor("ProgressBar.foreground"));
	}

	@Override
	public void uninstallUI(JComponent c) {

		c.setFont (null);
		c.setBackground (null);
		c.setForeground (null);
		c.setBorder (null);
		c.setCursor(null);

		super.uninstallUI(c);
	}

	@Override
	public void paint (Graphics g, JComponent c) {
		super.paint (MaterialDrawingUtils.getAliasedGraphics (g), c);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy