Java tutorial
import javax.swing.JCheckBox; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTabbedPane; import javax.swing.JTextField; import javax.swing.OverlayLayout; public class Main { public static void main(String[] args) { JPanel panel = new JPanel(); panel.setLayout(new OverlayLayout(panel)); JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.add("1", new JTextField("one")); tabbedPane.add("2", new JTextField("two")); tabbedPane.setAlignmentX(1.0f); tabbedPane.setAlignmentY(0.0f); JCheckBox checkBox = new JCheckBox("Add tab"); checkBox.setOpaque(false); checkBox.setAlignmentX(1.0f); checkBox.setAlignmentY(0.0f); panel.add(checkBox); panel.add(tabbedPane); JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(panel); frame.setSize(400, 100); frame.setVisible(true); } }