BevelBorder Class : BevelBorder « Swing « Java Tutorial






A bevel border draws a border with a three-dimensional appearance: raised or lowered.

public BevelBorder(int bevelType)
Border bevelBorder = new BevelBorder(BevelBorder.RAISED);


public static Border createBevelBorder(int bevelType)
Border bevelBorder = BorderFactory.createBevelBorder(BevelBorder.RAISED);


public static Border createLoweredBevelBorder()
Border bevelBorder = BorderFactory.createLoweredBevelBorder();

public static Border createRaisedBevelBorder()
Border bevelBorder = BorderFactory.createRaisedBevelBorder();


public BevelBorder(int bevelType, Color highlight, Color shadow)
Border bevelBorder = new BevelBorder(BevelBorder.RAISED, Color.PINK, Color.RED);


public static Border createBevelBorder(int bevelType, Color highlight, Color shadow)
Border bevelBorder = BorderFactory.createBevelBorder(BevelBorder.RAISED,Color.PINK, Color.RED);


public BevelBorder(int bevelType, Color highlightOuter, Color highlightInner,  Color shadowOuter, Color shadowInner)
Border bevelBorder = new BevelBorder(BevelBorder.RAISED, Color.PINK,  Color.PINK.brighter(), Color.RED, Color.RED.darker());


public static Border createBevelBorder(int bevelType, Color highlightOuter,  Color highlightInner, Color shadowOuter, Color shadowInner)
Border bevelBorder = BorderFactory.createBevelBorder(BevelBorder.RAISED,  Color.PINK, Color.PINK.brighter(), Color.RED, Color.RED.darker());

A BevelBorder is opaque, by default.

BevelBorder Class
import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.BevelBorder;

public class BevelBorderRAISED extends JFrame {

  public BevelBorderRAISED() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JPanel panel = new JPanel();
    JLabel label;

    label = new JLabel("Beveled (like a button)");
    label.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
    panel.add(label);



    getContentPane().add(panel);
    pack();
  }

  public static void main(String[] args) {
    BevelBorderRAISED s = new BevelBorderRAISED();
    s.setVisible(true);
  }
}








14.102.BevelBorder
14.102.1.BevelBorder ClassBevelBorder Class
14.102.2.Using BevelBorder's constructor to create BevelBorderUsing BevelBorder's constructor to create BevelBorder
14.102.3.A Raised Bevel BorderA Raised Bevel Border
14.102.4.Lowered BevelBorderLowered BevelBorder
14.102.5.Creating BevelBorder with Border color settingCreating BevelBorder with Border color setting