EtchedBorderSample.java Source code

Java tutorial

Introduction

Here is the source code for EtchedBorderSample.java

Source

import java.awt.Color;

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

public class EtchedBorderSample {
    public static void main(String args[]) {
        JFrame frame = new JFrame("Sample Borders");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Border etchedBorder = new EtchedBorder(EtchedBorder.RAISED, Color.RED, Color.PINK);

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

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