Mega Code Archive

 
Categories / Java Tutorial / Swing
 

Add a tab with a label taken from the name of the component

import javax.swing.JButton; import javax.swing.JTabbedPane; public class Main {   public static void main(String[] argv) throws Exception {     JTabbedPane pane = new JTabbedPane();     JButton component = new JButton("button");     component.setName("Tab Label");     pane.add(component);   } }