Java tutorial
import java.awt.BorderLayout; import javax.swing.Box; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTabbedPane; public class Main { JTabbedPane tabbedPane; JPanel panelTab1; JPanel panelTab2; public Main() { Box box1 = Box.createVerticalBox(); for (int i = 1; i <= 100; i++) { box1.add(new JLabel("This is Label #" + i)); } Box box2 = Box.createVerticalBox(); for (int i = 1; i <= 100; i++) { box2.add(new JLabel("This is Label #" + i)); } JPanel boxPanel1 = new JPanel(); JPanel boxPanel2 = new JPanel(); boxPanel1.add(box1); boxPanel2.add(box2); JScrollPane panel1Scroll = new JScrollPane(boxPanel1); JScrollPane panel2Scroll = new JScrollPane(boxPanel2); panelTab1 = new JPanel(new BorderLayout()); panelTab2 = new JPanel(new BorderLayout()); panelTab1.add(panel1Scroll); panelTab2.add(panel2Scroll); tabbedPane = new JTabbedPane(); tabbedPane.add(panelTab1, "Panel 1"); tabbedPane.add(panelTab2, "Panel 2"); JFrame frame = new JFrame(); frame.add(tabbedPane); frame.pack(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } public static void main(String[] args) { Main gui = new Main(); } }