Color MatteBorder : MatteBorder « Swing « Java Tutorial






Color MatteBorder
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 Border");
    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);
  }
}








14.107.MatteBorder
14.107.1.MatteBorder
14.107.2.Color MatteBorderColor MatteBorder
14.107.3.Using Icon to create border: MatteBorderUsing Icon to create border: MatteBorder
14.107.4.Creating and Setting a MatteBorder from BorderFactory