BevelBorderWithDiffBorderColor.java Source code

Java tutorial

Introduction

Here is the source code for BevelBorderWithDiffBorderColor.java

Source

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);
    }
}