ABevelBorder.java Source code

Java tutorial

Introduction

Here is the source code for ABevelBorder.java

Source

import java.awt.Color;
import java.awt.Container;
import java.awt.GridLayout;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.border.BevelBorder;
import javax.swing.border.Border;

public class ABevelBorder {
    public static void main(String args[]) {
        JFrame frame = new JFrame("Bevel Borders");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Border raisedBorder = BorderFactory.createRaisedBevelBorder();
        Border loweredBorder = BorderFactory.createLoweredBevelBorder();
        Border myRaisedBorder = BorderFactory.createBevelBorder(BevelBorder.RAISED, Color.pink, Color.red);
        Border myLoweredBorder = BorderFactory.createBevelBorder(BevelBorder.LOWERED, Color.pink, Color.red);
        JButton raisedButton = new JButton("Raised");
        raisedButton.setBorder(raisedBorder);
        JButton loweredButton = new JButton("Lowered");
        loweredButton.setBorder(loweredBorder);
        JButton myRaisedButton = new JButton("My Raised");
        myRaisedButton.setBorder(myRaisedBorder);
        JButton myLoweredButton = new JButton("My Lowered");
        myLoweredButton.setBorder(myLoweredBorder);
        Container contentPane = frame.getContentPane();
        contentPane.setLayout(new GridLayout(2, 2, 5, 5));
        contentPane.add(raisedButton);
        contentPane.add(loweredButton);
        contentPane.add(myRaisedButton);
        contentPane.add(myLoweredButton);
        frame.setSize(300, 100);
        frame.setVisible(true);
    }
}