Java examples for Swing:JTabbedPane
add Tab to JTabbedPane
import java.awt.Color; import java.awt.Component; import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Insets; import java.awt.geom.AffineTransform; import java.awt.image.BufferedImage; import javax.swing.ImageIcon; import javax.swing.JLabel; import javax.swing.JTabbedPane; import javax.swing.SwingUtilities; import javax.swing.UIManager; public class Main{ public static void addTab(JTabbedPane tabPane, String text, Component comp) {//from www. ja va2s . c o m int tabPlacement = tabPane.getTabPlacement(); switch (tabPlacement) { case JTabbedPane.LEFT: case JTabbedPane.RIGHT: tabPane.addTab("", new VerticalTextIcon(text, tabPlacement == JTabbedPane.RIGHT), comp); return; default: tabPane.addTab(text, null, comp); } } }