MainClass.java Source code

Java tutorial

Introduction

Here is the source code for MainClass.java

Source

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.border.Border;
import javax.swing.border.LineBorder;

public class MainClass {

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

        Border roundedBorder = new LineBorder(Color.BLACK, 12, true);

        JButton roundedButton = new JButton("Rounded 12 Pixel");
        roundedButton.setBorder(roundedBorder);

        Container contentPane = frame.getContentPane();
        contentPane.add(roundedButton, BorderLayout.SOUTH);
        frame.pack();
        frame.setSize(300, frame.getHeight());
        frame.setVisible(true);
    }
}