new EtchedBorder(int etchType, Color highlight, Color shadow) : EtchedBorder « javax.swing.border « Java by API






new EtchedBorder(int etchType, Color highlight, Color shadow)

 

import java.awt.Color;

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

public class Main {
  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);
  }
}

   
  








Related examples in the same category

1.EtchedBorder.LOWERED
2.EtchedBorder.RAISED
3.new EtchedBorder(int style)