new MatteBorder(int top, int left, int bottom, int right, Color matteColor) : MatteBorder « javax.swing.border « Java by API






new MatteBorder(int top, int left, int bottom, int right, Color matteColor)

 

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 Main {
  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);
  }
}

   
  








Related examples in the same category

1.new MatteBorder(int top, int left, int bottom, int right, Icon tileIcon)