Using BevelBorder's constructor to create BevelBorder : BevelBorder « Swing « Java Tutorial






Using BevelBorder's constructor to create BevelBorder
import java.awt.Color;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.border.BevelBorder;
import javax.swing.border.Border;

public class BevelBorderWithDiffBorderColor {
  public static void main(String args[]) {
    JFrame frame = new JFrame("Sample Borders");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Border bevelBorder = new BevelBorder(BevelBorder.RAISED, Color.RED, Color.RED.darker(),
        Color.PINK, Color.PINK.brighter());

    JLabel aLabel = new JLabel("Bevel");
    aLabel.setBorder(bevelBorder);
    aLabel.setHorizontalAlignment(JLabel.CENTER);

    frame.add(aLabel);
    frame.setSize(400, 200);
    frame.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