private void internalPaintTabBackground( Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected) { BufferedImage leftImg = null; BufferedImage middleImg = null; BufferedImage rightImg = null; Graphics2D g2 = (Graphics2D) g; AntialiasingManager.activateAntialiasing(g2); int tabOverlap = 0; if (isSelected) { if (tabPane.isEnabledAt(tabIndex)) { leftImg = DesktopUtilActivator.getImage(SELECTED_TAB_LEFT_BG); middleImg = DesktopUtilActivator.getImage(SELECTED_TAB_MIDDLE_BG); rightImg = DesktopUtilActivator.getImage(SELECTED_TAB_RIGHT_BG); tabOverlap = TAB_OVERLAP; } else { leftImg = DesktopUtilActivator.getImage(TAB_LEFT_BG); middleImg = DesktopUtilActivator.getImage(TAB_MIDDLE_BG); rightImg = DesktopUtilActivator.getImage(TAB_RIGHT_BG); } } else { leftImg = DesktopUtilActivator.getImage(TAB_LEFT_BG); middleImg = DesktopUtilActivator.getImage(TAB_MIDDLE_BG); rightImg = DesktopUtilActivator.getImage(TAB_RIGHT_BG); } // Remove the existing gap between the tabs and the panel, which is due // to the removal of the tabbed pane border. y++; // If the current tab is not the selected tab we paint it 2 more pixels // to the bottom in order to create the disabled look. if (!isSelected) y += 2; g2.drawImage(leftImg, x, y, null); g2.drawImage( middleImg, x + leftImg.getWidth(), y, w - leftImg.getWidth() - rightImg.getWidth() + tabOverlap, leftImg.getHeight(), null); g2.drawImage(rightImg, x + w - rightImg.getWidth() + tabOverlap, y, null); }
/** * Paints the UI for the given component through the given graphics object. * * @param g the <tt>Graphics</tt> object used for painting * @param c the component to paint */ public void paint(Graphics g, JComponent c) { AntialiasingManager.activateAntialiasing(g); super.paint(g, c); }