Java Swing Tutorial - Java BorderFactory .createBevelBorder (int type, Color highlightOuter, Color highlightInner, Color shadowOuter, Color shadowInner)








Syntax

BorderFactory.createBevelBorder(int type, Color highlightOuter, Color highlightInner, Color shadowOuter, Color shadowInner) has the following syntax.

public static Border createBevelBorder(int type,    Color highlightOuter,    Color highlightInner,    Color shadowOuter,    Color shadowInner)

Example

In the following code shows how to use BorderFactory.createBevelBorder(int type, Color highlightOuter, Color highlightInner, Color shadowOuter, Color shadowInner) method.

import java.awt.Color;
import java.awt.Container;
/* w w  w .  j av a 2s.c  o  m*/
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.border.BevelBorder;
import javax.swing.border.Border;



public class Main {

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

    Border myRaisedBorder = BorderFactory.createBevelBorder(BevelBorder.RAISED,
        Color.PINK, Color.RED,Color.PINK, Color.RED);
    JButton myRaisedButton = new JButton("My Raised");
    myRaisedButton.setBorder(myRaisedBorder);

    Container contentPane = frame.getContentPane();
    contentPane.add(myRaisedButton);
    frame.setSize(300, 200);
    frame.setVisible(true);

  }
}