Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.awt.Dimension;

import javax.swing.JFrame;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;

public class Main extends JFrame {

    private JTabbedPane tabbedPane;

    public Main() {
        tabbedPane = new JTabbedPane();
        tabbedPane.setPreferredSize(new Dimension(300, 200));
        getContentPane().add(tabbedPane);
        JTextField one = new JTextField("one");
        tabbedPane.add(one, "one");
        JTextField two = new JTextField("two");
        tabbedPane.add(two, "<html>T<br>i<br>t<br>t<br>l<br>e <br> 1 </html>");
        tabbedPane.setEnabledAt(2, false);

        tabbedPane.setTabPlacement(JTabbedPane.LEFT);
    }

    public static void main(String args[]) {
        Main frame = new Main();
        frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
        frame.pack();
        frame.setVisible(true);
    }
}