int tabPlacement = tabPane.getTabPlacement(); Insets insets = tabPane.getInsets(); int childCount = tabPane.getComponentCount(); if (childCount > 0) { int compX; int compY; int tabAreaWidth = 0; int tabAreaHeight = 0; switch (tabPlacement) { case LEFT: tabAreaWidth = calculateTabAreaWidth(tabPlacement, runCount, maxTabWidth); compX = tabAreaWidth + insets.left + contentBorderInsets.left; compY = insets.top + contentBorderInsets.top; break; case RIGHT: tabAreaWidth = calculateTabAreaWidth(tabPlacement, runCount, maxTabWidth); compX = insets.left + contentBorderInsets.left; compY = insets.top + contentBorderInsets.top; break; case BOTTOM: tabAreaHeight = calculateTabAreaHeight(tabPlacement, runCount, maxTabHeight); compX = insets.left + contentBorderInsets.left; compY = insets.top + contentBorderInsets.top; break; case TOP: default: tabAreaHeight = calculateTabAreaHeight(tabPlacement, runCount, maxTabHeight); compX = insets.left + contentBorderInsets.left; compY = tabAreaHeight + insets.top + contentBorderInsets.top; } Rectangle bounds = tabPane.getBounds(); int compWidth = bounds.width - tabAreaWidth - insets.left - insets.right - contentBorderInsets.left - contentBorderInsets.right; int compHeight = bounds.height - tabAreaHeight - insets.top - insets.bottom - contentBorderInsets.top - contentBorderInsets.bottom;   for (int i = 0; i < childCount; ++i) { Component c = tabPane.getComponent(i); c.setBounds(compX, compY, compWidth, compHeight); } }
    public void layoutContainer(Container parent)    {      calculateLayoutInfo();    }