MainClass.java Source code

Java tutorial

Introduction

Here is the source code for MainClass.java

Source

import java.awt.Container;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.border.TitledBorder;

public class MainClass {

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

        TitledBorder belowBottomBorder = BorderFactory.createTitledBorder("BelowBottom");
        belowBottomBorder.setTitlePosition(TitledBorder.BELOW_BOTTOM);
        JButton belowBottomButton = new JButton();
        belowBottomButton.setBorder(belowBottomBorder);

        Container contentPane = frame.getContentPane();
        contentPane.add(belowBottomButton);
        frame.setSize(300, 200);
        frame.setVisible(true);
    }
}