This repository has been archived on 2021-12-05. You can view files and clone it, but cannot push or open issues or pull requests.
envoy/src/main/java/envoy/client/ui/primary/PrimaryButton.java

64 lines
1.4 KiB
Java

package envoy.client.ui.primary;
import java.awt.Graphics;
import javax.swing.JButton;
/**
* Project: <strong>envoy-client</strong><br>
* File: <strong>PrimaryButton.javaEvent.java</strong><br>
* Created: <strong>07.12.2019</strong><br>
*
* @author Kai S. K. Engelbart
* @author Maximilian K&auml;fer
* @since Envoy Client v0.2-alpha
*/
public class PrimaryButton extends JButton {
private static final long serialVersionUID = 0L;
private int arcSize;
/**
* Creates a primary button
*
* @param title the title of the button
* @since Envoy 0.2-alpha
*/
public PrimaryButton(String title) { this(title, 6); }
/**
* Creates a primary button
*
* @param title the title of the button
* @param arcSize the size of the arc used to draw the round button edges
* @since Envoy 0.2-alpha
*/
public PrimaryButton(String title, int arcSize) {
super(title);
setBorderPainted(false);
setFocusPainted(false);
setContentAreaFilled(false);
this.arcSize = arcSize;
}
@Override
protected void paintComponent(Graphics g) {
g.setColor(getBackground());
g.fillRoundRect(0, 0, getWidth(), getHeight(), arcSize, arcSize);
super.paintComponent(g);
}
/**
* @return the arcSize
* @since Envoy 0.2-alpha
*/
public int getArcSize() { return arcSize; }
/**
* @param arcSize the arcSize to set
* @since Envoy 0.2-alpha
*/
public void setArcSize(int arcSize) { this.arcSize = arcSize; }
}