new LineBorder(Color color, int thickness) : LineBorder « javax.swing.border « Java by API






new LineBorder(Color color, int thickness)

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.LineBorder;

public class MainClass {

  public static void main(final String args[]) {
    JFrame frame = new JFrame("Line Borders");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    Border thickBorder = new LineBorder(Color.WHITE, 12);
    
    JButton thickButton = new JButton("12 Pixel");
    thickButton.setBorder(thickBorder);
    
    Container contentPane = frame.getContentPane();
    contentPane.add(thickButton, BorderLayout.NORTH);
    frame.pack();
    frame.setSize(300, frame.getHeight());
    frame.setVisible(true);
  }
}
           
       








Related examples in the same category

1.new LineBorder(Color color, int thickness, boolean roundedCorners)
2.LineBorder: createBlackLineBorder()
3.LineBorder: createGrayLineBorder()