68 lines
1.7 KiB
Java
68 lines
1.7 KiB
Java
package envoy.client.ui.primary;
|
|
|
|
import java.awt.Font;
|
|
import java.awt.Graphics;
|
|
|
|
import javax.swing.JTextArea;
|
|
import javax.swing.border.EmptyBorder;
|
|
|
|
/**
|
|
* Project: <strong>envoy-client</strong><br>
|
|
* File: <strong>PrimaryTextArea.javaEvent.java</strong><br>
|
|
* Created: <strong>07.12.2019</strong><br>
|
|
*
|
|
* @author Maximilian Käfer
|
|
* @since Envoy Client v0.2-alpha
|
|
*/
|
|
public class PrimaryTextArea extends JTextArea {
|
|
|
|
private static final long serialVersionUID = -5829028696155434913L;
|
|
private int arcSize;
|
|
|
|
/**
|
|
* Creates the text area
|
|
*
|
|
* @param borderSpace the space between components
|
|
* @since Envoy 0.2-alpha
|
|
*/
|
|
public PrimaryTextArea(int borderSpace) { this(6, borderSpace); }
|
|
|
|
/**
|
|
* Creates the text area
|
|
*
|
|
* @param arcSize is the diameter of the arc at the four corners.
|
|
* @param borderSpace is the insets of the border on all four sides.
|
|
* @since Envoy 0.2-alpha
|
|
*/
|
|
public PrimaryTextArea(int arcSize, int borderSpace) {
|
|
super();
|
|
setWrapStyleWord(true);
|
|
setLineWrap(true);
|
|
setBorder(null);
|
|
setFont(new Font("Arial", Font.PLAIN, 17));
|
|
setBorder(new EmptyBorder(borderSpace, borderSpace, borderSpace, borderSpace));
|
|
setOpaque(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 - the diameter of the arc at the four corners.
|
|
* @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; }
|
|
}
|