Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.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.MatteBorder;

public class Main {
    public static void main(String args[]) {
        JFrame frame = new JFrame("Color Matted Border");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Border solidBorder = new MatteBorder(10, 5, 2, 20, Color.RED);
        JButton solidButton = new JButton("10x5x2x20");
        solidButton.setBorder(solidBorder);
        Container contentPane = frame.getContentPane();
        contentPane.add(solidButton, BorderLayout.CENTER);
        frame.setSize(300, 100);
        frame.setVisible(true);
    }
}