Setting Border color for SoftBevelBorder : SoftBevelBorder « Swing « Java Tutorial






Setting Border color for SoftBevelBorder
import java.awt.Color;

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

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

    Border softBevelBorder = new SoftBevelBorder(BevelBorder.RAISED, Color.RED, Color.RED.darker(),
        Color.PINK, Color.PINK.brighter());

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

    frame.add(aLabel);
    frame.setSize(400, 200);
    frame.setVisible(true);
  }
}








14.103.SoftBevelBorder
14.103.1.SoftBevelBorder has three constructors
14.103.2.Setting Border color for SoftBevelBorderSetting Border color for SoftBevelBorder
14.103.3.Raised and Lowered SoftBevelBorderRaised and Lowered SoftBevelBorder