protected void paintText( Graphics g, int tabPlacement, Font font, FontMetrics metrics, int tabIndex, String title, Rectangle textRect, boolean isSelected) { long currentTime = System.currentTimeMillis(); Progressor p = (Progressor) tabPane.getComponentAt(tabIndex); double percent = p.calculatePercentage(currentTime); if (percent > 1) percent = 1.0; PROGRESS.setValue((int) (percent * 100)); Rectangle tabRect = tabPane.getBoundsAt(tabIndex); int x, y, w, h; x = textRect.x - 4; y = textRect.y; w = tabRect.width + tabRect.x - x - 1; h = tabRect.height + tabRect.y - y; PANE.paintComponent(g, PROGRESS, tabPane.getParent(), x, y, w, h); super.paintText(g, tabPlacement, font, metrics, tabIndex, title, textRect, isSelected); }
protected void paintTabBackground( Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected) { super.paintTabBackground(g, tabPlacement, tabIndex, x, y, w, h, isSelected); Color darker = tabPane.getBackgroundAt(tabIndex).darker(); g.setColor(darker); long currentTime = System.currentTimeMillis(); Progressor p = (Progressor) tabPane.getComponentAt(tabIndex); double percent = p.calculatePercentage(currentTime); if (percent > 1) percent = 1.0; g.fillRect(x + 1, y + 1, (int) ((w - 3) * percent), h - 1); }