@Override
public void paint(Graphics2D graphics) {
TabPane tabPane = (TabPane)getComponent();
Bounds tabPaneBounds = tabPane.getBounds();
// Call the base class to paint the background
super.paint(graphics);
// Paint the content background and border
int x = 0;
int y = 0;
int width = 0;
int height = 0;
switch (tabOrientation) {
case HORIZONTAL: {
x = 0;
y = Math.max(buttonPanorama.getY() + buttonPanorama.getHeight() - 1, 0);
width = tabPaneBounds.width;
height = Math.max(tabPaneBounds.height - y, 0);
break;
}
case VERTICAL: {
x = Math.max(buttonPanorama.getX() + buttonPanorama.getWidth() - 1, 0);
y = 0;
width = Math.max(tabPaneBounds.width - x, 0);
height = tabPaneBounds.height;
break;
}
}
int selectedIndex = tabPane.getSelectedIndex();
if (selectedIndex != -1
|| selectionChangeTransition != null) {
Bounds contentBounds = new Bounds(x, y, width, height);
graphics.setPaint(activeTabColor);
graphics.fillRect(contentBounds.x, contentBounds.y,
contentBounds.width, contentBounds.height);