MatteBorder Demo
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.border.Border;
import javax.swing.border.MatteBorder;
public class ColorMatteBorder {
public static void main(String args[]) {
JFrame frame = new JFrame("Color Matted Borders");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Border solidBorder = new MatteBorder(10, 5, 2, 20, Color.red);
JButton solidButton = new JButton("10x5x2x20");
solidButton.setBorder(solidBorder);
Container contentPane = frame.getContentPane();
contentPane.add(solidButton, BorderLayout.CENTER);
frame.setSize(300, 100);
frame.setVisible(true);
}
}
Related examples in the same category