Bold in JTabbedPane title overlapping tab edge

I extended the BasicTabbedPaneUI and implemented paintText() to use a bold font if the tab is selected. This works OK, unless the tab has a long title in which case the bold text overlaps the edge of the tab. I tried using a smaller font size, but it still didn't work in some cases.
How do I change the size of the tab?
Here's my implementation:
-------------------------MyTabbedPane.java-----------------------
<pre>
import javax.swing.plaf.basic.BasicTabbedPaneUI;
import java.awt.*;
public class MyTabbedPaneUI extends BasicTabbedPaneUI {
     private Font boldFont = null;
     public MyTabbedPaneUI(Font font)
          this.boldFont = new Font(font.getFontName(), Font.BOLD, font.getSize());
     protected void paintText(Graphics g,
                              int tabPlacement,
                              Font font,
                              FontMetrics metrics,
                              int tabIndex,
                              String title,
                              Rectangle textRect,
                              boolean isSelected)
          if(isSelected)
               super.paintText(g, tabPlacement, boldFont, metrics, tabIndex, title, textRect, isSelected);
          else
               super.paintText(g, tabPlacement, font, metrics, tabIndex, title, textRect, isSelected);
</pre>
------Here's how it's used-----------
JTabbedPane tabbedPaneTop = new JTabbedPane(JTabbedPane.TOP, JTabbedPane.WRAP_TAB_LAYOUT);
// set-up tab UI
MyTabbedPaneUI tabUI = new MyTabbedPaneUI(tabbedPaneTop.getFont());
tabbedPaneTop.setUI(tabUI);

I figured out how to fix my problem. Had to override a couple more methods. See my code below.
import javax.swing.plaf.basic.BasicTabbedPaneUI;
import java.awt.*;
import javax.swing.*;
public class MyTabbedPaneUI extends BasicTabbedPaneUI {
     private Font boldFont = null;
     private FontMetrics boldFM = null;
     public MyTabbedPaneUI(Font font)
          this.boldFont = new Font(font.getFontName(), Font.BOLD, font.getSize());
     public void installUI(JComponent c)
          super.installUI(c);
          this.boldFM = c.getFontMetrics(this.boldFont);
     protected void paintText(Graphics g,
                   int tabPlacement,
                   Font font,
                   FontMetrics metrics,
                   int tabIndex,
                   String title,
                              Rectangle textRect,
                   boolean isSelected)
          if(isSelected)
               Rectangle rect = this.getTabBounds(this.tabPane, tabIndex);
               int centerX = rect.x + rect.width/2;
               int centerY = rect.y + rect.height/2;
               int textH = this.boldFM.getHeight();
               int textW = this.boldFM.stringWidth(this.tabPane.getTitleAt(tabIndex));
               rect.x = centerX - textW/2;
               rect.y = centerY - textH/2;
               rect.width = textW;
               rect.height = textH;
               super.paintText(g, tabPlacement, boldFont, this.boldFM, tabIndex, title, rect, isSelected);
          else
               super.paintText(g, tabPlacement, font, metrics, tabIndex, title, textRect, isSelected);
     protected int calculateTabWidth(int tabPlacement, int tabIndex, FontMetrics metrics)
          if (this.tabPane.getSelectedIndex() == tabIndex)
               return super.calculateTabWidth(tabPlacement, tabIndex, this.boldFM);
          else
               return super.calculateTabWidth(tabPlacement, tabIndex, metrics);
}

Similar Messages

  • Button in JTabbedPane Title

    Hi all
    I am Using JTabbedPane I need to include button for close within every tab. How I Do this one using swings

    hi!
    for that you need to use the javax.swing.plaf.basic.BasicTabbedPaneUI class. i wrote
    package una.common.file.vc.gui.control;
    import java.awt.Component;
    import java.awt.Container;
    import java.awt.Dimension;
    import java.awt.Event;
    import java.awt.Font;
    import java.awt.FontMetrics;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.Insets;
    import java.awt.LayoutManager;
    import java.awt.Point;
    import java.awt.Rectangle;
    import java.awt.Shape;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.ContainerEvent;
    import java.awt.event.ContainerListener;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseListener;
    import java.awt.event.MouseMotionListener;
    import java.awt.image.BufferedImage;
    import java.util.EventListener;
    import java.util.Hashtable;
    import java.util.Vector;
    import javax.swing.AbstractAction;
    import javax.swing.ActionMap;
    import javax.swing.Icon;
    import javax.swing.InputMap;
    import javax.swing.JButton;
    import javax.swing.JComponent;
    import javax.swing.JMenuItem;
    import javax.swing.JPanel;
    import javax.swing.JPopupMenu;
    import javax.swing.JTabbedPane;
    import javax.swing.JViewport;
    import javax.swing.KeyStroke;
    import javax.swing.SwingConstants;
    import javax.swing.SwingUtilities;
    import javax.swing.UIManager;
    import javax.swing.border.Border;
    import javax.swing.border.SoftBevelBorder;
    import javax.swing.event.ChangeEvent;
    import javax.swing.event.ChangeListener;
    import javax.swing.plaf.ActionMapUIResource;
    import javax.swing.plaf.ComponentUI;
    import javax.swing.plaf.InputMapUIResource;
    import javax.swing.plaf.UIResource;
    import javax.swing.plaf.basic.BasicArrowButton;
    import javax.swing.plaf.basic.BasicHTML;
    import javax.swing.plaf.basic.BasicTabbedPaneUI;
    import javax.swing.text.View;
    import una.common.file.vc.gui.VCResource;
    * UI for <code>VCTabbedPane</code>.
    * <p>
    * Credits to:
    public class VCTabPaneUI extends BasicTabbedPaneUI implements ActionListener
         // Instance variables initialized at installation
         private ContainerListener          containerListener;
         private Vector                         htmlViews;
         private Hashtable                    mnemonicToIndexMap;
          * InputMap used for mnemonics. Only non-null if the JTabbedPane has
          * mnemonics associated with it. Lazily created in initMnemonics.
         private InputMap                    mnemonicInputMap;
         // For use when tabLayoutPolicy = SCROLL_TAB_LAYOUT
         protected ScrollableTabSupport     tabScroller;
         private int                              tabCount;
         protected MyMouseMotionListener     motionListener;
         // UI creation
         private static final int          INACTIVE                    = 0;
         private static final int          OVER                         = 1;
         private static final int          PRESSED                         = 2;
         protected static final int          BUTTONSIZE                    = 15;
         protected static final int          WIDTHDELTA                    = 5;
         private static final Border          PRESSEDBORDER               = new SoftBevelBorder(
                                                                                         SoftBevelBorder.LOWERED);
         private static final Border          OVERBORDER                    = new SoftBevelBorder(
                                                                                         SoftBevelBorder.RAISED);
         private BufferedImage               closeImgB;
         private BufferedImage               closeImgI;
         private JButton                         closeB;
         private int                              overTabIndex               = -1;
         private int                              closeIndexStatus          = INACTIVE;
         private int                              maxIndexStatus               = INACTIVE;
         private boolean                         mousePressed               = false;
         private boolean                         isCloseButtonEnabled     = true;
         private JPopupMenu                    actionPopupMenu               = null;
         private JMenuItem                    closeItem                    = null;
         private JMenuItem                    closeOthers                    = null;
         private JMenuItem                    closeAll                    = null;
         public VCTabPaneUI()
              super();
              closeImgB = new BufferedImage(BUTTONSIZE, BUTTONSIZE,
                        BufferedImage.TYPE_4BYTE_ABGR);
              closeImgI = new BufferedImage(BUTTONSIZE, BUTTONSIZE,
                        BufferedImage.TYPE_4BYTE_ABGR);
              closeB = new JButton("X");
              closeB.setSize(BUTTONSIZE, BUTTONSIZE);
              actionPopupMenu = new JPopupMenu();
              closeItem = new JMenuItem(VCResource.getString("CLOSE"));
              closeOthers = new JMenuItem(VCResource.getString("CLOSE_OTHERS"));
              closeAll = new JMenuItem(VCResource.getString("CLOSE_ALL"));
              actionPopupMenu.add(closeItem);
              actionPopupMenu.add(closeOthers);
              actionPopupMenu.add(closeAll);
              closeItem.addActionListener(this);
              closeOthers.addActionListener(this);
              closeAll.addActionListener(this);
         protected boolean isOneActionButtonEnabled()
              return isCloseButtonEnabled;
         public boolean isCloseEnabled()
              return isCloseButtonEnabled;
         public void setCloseIcon(boolean b)
              isCloseButtonEnabled = b;
         protected int calculateTabWidth(int tabPlacement, int tabIndex,
                   FontMetrics metrics)
              int delta = 2;
              if (!isOneActionButtonEnabled())
                   delta += 6;
              else
                   if (isCloseButtonEnabled)
                        delta += BUTTONSIZE + WIDTHDELTA;
              return super.calculateTabWidth(tabPlacement, tabIndex, metrics) + delta;
         protected int calculateTabHeight(int tabPlacement, int tabIndex,
                   int fontHeight)
              return super.calculateTabHeight(tabPlacement, tabIndex, fontHeight) + 5;
         protected void layoutLabel(int tabPlacement, FontMetrics metrics,
                   int tabIndex, String title, Icon icon, Rectangle tabRect,
                   Rectangle iconRect, Rectangle textRect, boolean isSelected)
              textRect.x = textRect.y = iconRect.x = iconRect.y = 0;
              View v = getTextViewForTab(tabIndex);
              if (v != null)
                   tabPane.putClientProperty("html", v);
              SwingUtilities.layoutCompoundLabel((JComponent) tabPane, metrics,
                        title, icon, SwingUtilities.CENTER, SwingUtilities.LEFT,
                        SwingUtilities.CENTER, SwingUtilities.CENTER, tabRect,
                        iconRect, textRect, textIconGap);
              tabPane.putClientProperty("html", null);
              iconRect.x = tabRect.x + 8;
              textRect.x = iconRect.x + iconRect.width + textIconGap;
         protected MouseListener createMouseListener()
              return new MyMouseHandler();
         protected ScrollableTabButton createScrollableTabButton(int direction)
              return new ScrollableTabButton(direction);
         protected Rectangle newCloseRect(Rectangle rect)
              int dx = rect.x + rect.width;
              int dy = (rect.y + rect.height) / 2 - 6;
              return new Rectangle(dx - BUTTONSIZE - WIDTHDELTA, dy, BUTTONSIZE,
                        BUTTONSIZE);
         protected Rectangle newMaxRect(Rectangle rect)
              int dx = rect.x + rect.width;
              int dy = (rect.y + rect.height) / 2 - 6;
              if (isCloseButtonEnabled)
                   dx -= BUTTONSIZE;
              return new Rectangle(dx - BUTTONSIZE - WIDTHDELTA, dy, BUTTONSIZE,
                        BUTTONSIZE);
         protected void updateOverTab(int x, int y)
              if (overTabIndex != (overTabIndex = getTabAtLocation(x, y)))
                   tabScroller.tabPanel.repaint();
         protected void updateCloseIcon(int x, int y)
              if (overTabIndex != -1)
                   int newCloseIndexStatus = INACTIVE;
                   Rectangle closeRect = newCloseRect(rects[overTabIndex]);
                   if (closeRect.contains(x, y))
                        newCloseIndexStatus = mousePressed ? PRESSED : OVER;
                   if (closeIndexStatus != (closeIndexStatus = newCloseIndexStatus))
                        tabScroller.tabPanel.repaint();
    //     protected void updateMaxIcon(int x, int y)
    //          if (overTabIndex != -1)
    //               int newMaxIndexStatus = INACTIVE;
    //               Rectangle maxRect = newMaxRect(rects[overTabIndex]);
    //               if (maxRect.contains(x, y))
    //                    newMaxIndexStatus = mousePressed ? PRESSED : OVER;
    //               if (maxIndexStatus != (maxIndexStatus = newMaxIndexStatus))
    //                    tabScroller.tabPanel.repaint();
         private void setTabIcons(int x, int y)
              // if the mouse isPressed
              if (!mousePressed)
                   updateOverTab(x, y);
              if (isCloseButtonEnabled)
                   updateCloseIcon(x, y);
         public static ComponentUI createUI(JComponent c)
              return new VCTabPaneUI();
          * Invoked by <code>installUI</code> to create a layout manager object to
          * manage the <code>JTabbedPane</code>.
          * @return a layout manager object
          * @see TabbedPaneLayout
          * @see javax.swing.JTabbedPane#getTabLayoutPolicy
         protected LayoutManager createLayoutManager()
              return new TabbedPaneScrollLayout();
          * In an attempt to preserve backward compatibility for programs which have
          * extended BasicTabbedPaneUI to do their own layout, the UI uses the
          * installed layoutManager (and not tabLayoutPolicy) to determine if
          * scrollTabLayout is enabled.
          * Creates and installs any required subcomponents for the JTabbedPane.
          * Invoked by installUI.
          * @since 1.4
         protected void installComponents()
              if (tabScroller == null)
                   tabScroller = new ScrollableTabSupport(tabPane.getTabPlacement());
                   tabPane.add(tabScroller.viewport);
                   tabPane.add(tabScroller.scrollForwardButton);
                   tabPane.add(tabScroller.scrollBackwardButton);
          * Removes any installed subcomponents from the JTabbedPane. Invoked by
          * uninstallUI.
          * @since 1.4
         protected void uninstallComponents()
              tabPane.remove(tabScroller.viewport);
              tabPane.remove(tabScroller.scrollForwardButton);
              tabPane.remove(tabScroller.scrollBackwardButton);
              tabScroller = null;
         protected void installListeners()
              if ((propertyChangeListener = createPropertyChangeListener()) != null)
                   tabPane.addPropertyChangeListener(propertyChangeListener);
              if ((tabChangeListener = createChangeListener()) != null)
                   tabPane.addChangeListener(tabChangeListener);
              if ((mouseListener = createMouseListener()) != null)
                   tabScroller.tabPanel.addMouseListener(mouseListener);
              if ((focusListener = createFocusListener()) != null)
                   tabPane.addFocusListener(focusListener);
              // PENDING(api) : See comment for ContainerHandler
              if ((containerListener = new ContainerHandler()) != null)
                   tabPane.addContainerListener(containerListener);
                   if (tabPane.getTabCount() > 0)
                        htmlViews = createHTMLVector();
              if ((motionListener = new MyMouseMotionListener()) != null)
                   tabScroller.tabPanel.addMouseMotionListener(motionListener);
         protected void uninstallListeners()
              if (mouseListener != null)
                   tabScroller.tabPanel.removeMouseListener(mouseListener);
                   mouseListener = null;
              if (motionListener != null)
                   tabScroller.tabPanel.removeMouseMotionListener(motionListener);
                   motionListener = null;
              if (focusListener != null)
                   tabPane.removeFocusListener(focusListener);
                   focusListener = null;
              // PENDING(api): See comment for ContainerHandler
              if (containerListener != null)
                   tabPane.removeContainerListener(containerListener);
                   containerListener = null;
                   if (htmlViews != null)
                        htmlViews.removeAllElements();
                        htmlViews = null;
              if (tabChangeListener != null)
                   tabPane.removeChangeListener(tabChangeListener);
                   tabChangeListener = null;
              if (propertyChangeListener != null)
                   tabPane.removePropertyChangeListener(propertyChangeListener);
                   propertyChangeListener = null;
         protected ChangeListener createChangeListener()
              return new TabSelectionHandler();
         protected void installKeyboardActions()
              InputMap km = getMyInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
              SwingUtilities.replaceUIInputMap(tabPane,
                        JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, km);
              km = getMyInputMap(JComponent.WHEN_FOCUSED);
              SwingUtilities.replaceUIInputMap(tabPane, JComponent.WHEN_FOCUSED, km);
              ActionMap am = createMyActionMap();
              SwingUtilities.replaceUIActionMap(tabPane, am);
              tabScroller.scrollForwardButton.setAction(am
                        .get("scrollTabsForwardAction"));
              tabScroller.scrollBackwardButton.setAction(am
                        .get("scrollTabsBackwardAction"));
         InputMap getMyInputMap(int condition)
              if (condition == JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
                   return (InputMap) UIManager.get("TabbedPane.ancestorInputMap");
              } else if (condition == JComponent.WHEN_FOCUSED)
                   return (InputMap) UIManager.get("TabbedPane.focusInputMap");
              return null;
         ActionMap createMyActionMap()
              ActionMap map = new ActionMapUIResource();
              map.put("navigateNext", new NextAction());
              map.put("navigatePrevious", new PreviousAction());
              map.put("navigateRight", new RightAction());
              map.put("navigateLeft", new LeftAction());
              map.put("navigateUp", new UpAction());
              map.put("navigateDown", new DownAction());
              map.put("navigatePageUp", new PageUpAction());
              map.put("navigatePageDown", new PageDownAction());
              map.put("requestFocus", new RequestFocusAction());
              map.put("requestFocusForVisibleComponent",
                        new RequestFocusForVisibleAction());
              map.put("setSelectedIndex", new SetSelectedIndexAction());
              map.put("scrollTabsForwardAction", new ScrollTabsForwardAction());
              map.put("scrollTabsBackwardAction", new ScrollTabsBackwardAction());
              return map;
         protected void uninstallKeyboardActions()
              SwingUtilities.replaceUIActionMap(tabPane, null);
              SwingUtilities.replaceUIInputMap(tabPane,
                        JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, null);
              SwingUtilities
                        .replaceUIInputMap(tabPane, JComponent.WHEN_FOCUSED, null);
          * Reloads the mnemonics. This should be invoked when a memonic changes,
          * when the title of a mnemonic changes, or when tabs are added/removed.
         private void updateMnemonics()
              resetMnemonics();
              for (int counter = tabPane.getTabCount() - 1; counter >= 0; counter--)
                   int mnemonic = tabPane.getMnemonicAt(counter);
                   if (mnemonic > 0)
                        addMnemonic(counter, mnemonic);
          * Resets the mnemonics bindings to an empty state.
         private void resetMnemonics()
              if (mnemonicToIndexMap != null)
                   mnemonicToIndexMap.clear();
                   mnemonicInputMap.clear();
          * Adds the specified mnemonic at the specified index.
         private void addMnemonic(int index, int mnemonic)
              if (mnemonicToIndexMap == null)
                   initMnemonics();
              mnemonicInputMap.put(KeyStroke.getKeyStroke(mnemonic, Event.ALT_MASK),
                        "setSelectedIndex");
              mnemonicToIndexMap.put(new Integer(mnemonic), new Integer(index));
          * Installs the state needed for mnemonics.
         private void initMnemonics()
              mnemonicToIndexMap = new Hashtable();
              mnemonicInputMap = new InputMapUIResource();
              mnemonicInputMap.setParent(SwingUtilities.getUIInputMap(tabPane,
                        JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT));
              SwingUtilities
                        .replaceUIInputMap(tabPane,
                                  JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT,
                                  mnemonicInputMap);
         // UI Rendering
         public void paint(Graphics g, JComponent c)
              int tc = tabPane.getTabCount();
              if (tabCount != tc)
                   tabCount = tc;
                   updateMnemonics();
              int selectedIndex = tabPane.getSelectedIndex();
              int tabPlacement = tabPane.getTabPlacement();
              ensureCurrentLayout();
              // Paint content border
              paintContentBorder(g, tabPlacement, selectedIndex);
         protected void paintTab(Graphics g, int tabPlacement, Rectangle[] rects,
                   int tabIndex, Rectangle iconRect, Rectangle textRect)
              Rectangle tabRect = rects[tabIndex];
              int selectedIndex = tabPane.getSelectedIndex();
              boolean isSelected = selectedIndex == tabIndex;
              boolean isOver = overTabIndex == tabIndex;
              Graphics2D g2 = null;
              Shape save = null;
              boolean cropShape = false;
              int cropx = 0;
              int cropy = 0;
              if (g instanceof Graphics2D)
                   g2 = (Graphics2D) g;
                   // Render visual for cropped tab edge...
                   Rectangle viewRect = tabScroller.viewport.getViewRect();
                   int cropline;
                   cropline = viewRect.x + viewRect.width;
                   if ((tabRect.x < cropline)
                             && (tabRect.x + tabRect.width > cropline))
                        cropx = cropline - 1;
                        cropy = tabRect.y;
                        cropShape = true;
                   if (cropShape)
                        save = g2.getClip();
                        g2
                                  .clipRect(tabRect.x, tabRect.y, tabRect.width,
                                            tabRect.height);
              paintTabBackground(g, tabPlacement, tabIndex, tabRect.x, tabRect.y,
                        tabRect.width, tabRect.height, isSelected);
              paintTabBorder(g, tabPlacement, tabIndex, tabRect.x, tabRect.y,
                        tabRect.width, tabRect.height, isSelected);
              String title = tabPane.getTitleAt(tabIndex);
              Font font = tabPane.getFont();
              FontMetrics metrics = g.getFontMetrics(font);
              Icon icon = getIconForTab(tabIndex);
              layoutLabel(tabPlacement, metrics, tabIndex, title, icon, tabRect,
                        iconRect, textRect, isSelected);
              paintText(g, tabPlacement, font, metrics, tabIndex, title, textRect,
                        isSelected);
              paintIcon(g, tabPlacement, tabIndex, icon, iconRect, isSelected);
              paintFocusIndicator(g, tabPlacement, rects, tabIndex, iconRect,
                        textRect, isSelected);
              if (cropShape)
                   paintCroppedTabEdge(g, tabPlacement, tabIndex, isSelected, cropx,
                             cropy);
                   g2.setClip(save);
              } else if (isOver || isSelected)
                   int dx = tabRect.x + tabRect.width - BUTTONSIZE - WIDTHDELTA;
                   int dy = (tabRect.y + tabRect.height) / 2 - 6;
                   if (isCloseButtonEnabled)
                        paintCloseIcon(g2, dx, dy, isOver);
         protected void paintCloseIcon(Graphics g, int dx, int dy, boolean isOver)
              paintActionButton(g, dx, dy, closeIndexStatus, isOver, closeB,
                        closeImgB);
              g.drawImage(closeImgI, dx, dy + 1, null);
         protected void paintActionButton(Graphics g, int dx, int dy, int status,
                   boolean isOver, JButton button, BufferedImage image)
              button.setBorder(null);
              if (isOver)
                   switch (status)
                   case OVER:
                        button.setBorder(OVERBORDER);
                        break;
                   case PRESSED:
                        button.setBorder(PRESSEDBORDER);
                        break;
              button.setBackground(tabScroller.tabPanel.getBackground());
              button.paint(image.getGraphics());
              g.drawImage(image, dx, dy, null);
          * This method will create and return a polygon shape for the given tab
          * rectangle which has been cropped at the specified cropline with a torn
          * edge visual. e.g. A "File" tab which has cropped been cropped just after
          * the "i": ------------- | ..... | | . | | ... . | | . . | | . . | | . . |
          * The x, y arrays below define the pattern used to create a "torn" edge
          * segment which is repeated to fill the edge of the tab. For tabs placed on
          * TOP and BOTTOM, this righthand torn edge is created by line segments
          * which are defined by coordinates obtained by subtracting xCropLen[i] from
          * (tab.x + tab.width) and adding yCroplen[i] to (tab.y). For tabs placed on
          * LEFT or RIGHT, the bottom torn edge is created by subtracting xCropLen[i]
          * from (tab.y + tab.height) and adding yCropLen[i] to (tab.x).
         private static final int     CROP_SEGMENT     = 12;
         private void paintCroppedTabEdge(Graphics g, int tabPlacement,
                   int tabIndex, boolean isSelected, int x, int y)
              g.setColor(shadow);
              g.drawLine(x, y, x, y + rects[tabIndex].height);
         private void ensureCurrentLayout()
              if (!tabPane.isValid())
                   tabPane.validate();
               * If tabPane doesn't have a peer yet, the validate() call will silently
               * fail. We handle that by forcing a layout if tabPane is still invalid.
               * See bug 4237677.
              if (!tabPane.isValid())
                   TabbedPaneLayout layout = (TabbedPaneLayout) tabPane.getLayout();
                   layout.calculateLayoutInfo();
          * Returns the bounds of the specified tab in the coordinate space of the
          * JTabbedPane component. This is required because the tab rects are by
          * default defined in the coordinate space of the component where they are
          * rendered, which could be the JTabbedPane (for WRAP_TAB_LAYOUT) or a
          * ScrollableTabPanel (SCROLL_TAB_LAYOUT). This method should be used
          * whenever the tab rectangle must be relative to the JTabbedPane itself and
          * the result should be placed in a designated Rectangle object (rather than
          * instantiating and returning a new Rectangle each time). The tab index
          * parameter must be a valid tabbed pane tab index (0 to tab count - 1,
          * inclusive). The destination rectangle parameter must be a valid
          * <code>Rectangle</code> instance. The handling of invalid parameters is
          * unspecified.
          * @param tabIndex
          *            the index of the tab
          * @param dest
          *            the rectangle where the result should be placed
          * @return the resulting rectangle
          * @since 1.4
         protected Rectangle getTabBounds(int tabIndex, Rectangle dest)
              try{
                   dest.width = rects[tabIndex].width;
                   dest.height = rects[tabIndex].height;
                   Point vpp = tabScroller.viewport.getLocation();
                   Point viewp = tabScroller.viewport.getViewPosition();
                   dest.x = rects[tabIndex].x + vpp.x - viewp.x;
                   dest.y = rects[tabIndex].y + vpp.y - viewp.y;
              }catch(Throwable a_th){}
              return dest;
         private int getTabAtLocation(int x, int y)
              ensureCurrentLayout();
              int tabCount = tabPane.getTabCount();
              for (int i = 0; i < tabCount; i++)
                   if (rects.contains(x, y))
                        return i;
              return -1;
         public int getOverTabIndex()
              return overTabIndex;
         * Returns the index of the tab closest to the passed in location, note that
         * the returned tab may not contain the location x,y.
         private int getClosestTab(int x, int y)
              int min = 0;
              int tabCount = Math.min(rects.length, tabPane.getTabCount());
              int max = tabCount;
              int tabPlacement = tabPane.getTabPlacement();
              boolean useX = (tabPlacement == TOP || tabPlacement == BOTTOM);
              int want = (useX) ? x : y;
              while (min != max)
                   int current = (max + min) / 2;
                   int minLoc;
                   int maxLoc;
                   if (useX)
                        minLoc = rects[current].x;
                        maxLoc = minLoc + rects[current].width;
                   } else
                        minLoc = rects[current].y;
                        maxLoc = minLoc + rects[current].height;
                   if (want < minLoc)
                        max = current;
                        if (min == max)
                             return Math.max(0, current - 1);
                   } else if (want >= maxLoc)
                        min = current;
                        if (max - min <= 1)
                             return Math.max(current + 1, tabCount - 1);
                   } else
                        return current;
              return min;
         * Returns a point which is translated from the specified point in the
         * JTabbedPane's coordinate space to the coordinate space of the
         * ScrollableTabPanel. This is used for SCROLL_TAB_LAYOUT ONLY.
         private Point translatePointToTabPanel(int srcx, int srcy, Point dest)
              Point vpp = tabScroller.viewport.getLocation();
              Point viewp = tabScroller.viewport.getViewPosition();
              dest.x = srcx + vpp.x + viewp.x;
              dest.y = srcy + vpp.y + viewp.y;
              return dest;
         // BasicTabbedPaneUI methods
         // Tab Navigation methods
         // REMIND(ADC,7/29/98): This method should be made
         // protected in the next release where
         // API changes are allowed
         boolean requestMyFocusForVisibleComponent()
              Component visibleComponent = getVisibleComponent();
              if (visibleComponent.isFocusTraversable())
                   visibleComponent.requestFocus();
                   return true;
              } else if (visibleComponent instanceof JComponent)
                   if (((JComponent) visibleComponent).requestDefaultFocus())
                        return true;
              return false;
         private static class RightAction extends AbstractAction
              public void actionPerformed(ActionEvent e)
                   JTabbedPane pane = (JTabbedPane) e.getSource();
                   VCTabPaneUI ui = (VCTabPaneUI) pane.getUI();
                   ui.navigateSelectedTab(EAST);
         private static class LeftAction extends AbstractAction
              public void actionPerformed(ActionEvent e)
                   JTabbedPane pane = (JTabbedPane) e.getSource();
                   VCTabPaneUI ui = (VCTabPaneUI) pane.getUI();
                   ui.navigateSelectedTab(WEST);
         private static class UpAction extends AbstractAction
              public void actionPerformed(ActionEvent e)
                   JTabbedPane pane = (JTabbedPane) e.getSource();
                   VCTabPaneUI ui = (VCTabPaneUI) pane.getUI();
                   ui.navigateSelectedTab(NORTH);
         private static class DownAction extends AbstractAction
              public void actionPerformed(ActionEvent e)
                   JTabbedPane pane = (JTabbedPane) e.getSource();
                   VCTabPaneUI ui = (VCTabPaneUI) pane.getUI();
                   ui.navigateSelectedTab(SOUTH);
         private static class NextAction extends AbstractAction
              public void actionPerformed(ActionEvent e)
                   JTabbedPane pane = (JTabbedPane) e.getSource();
                   VCTabPaneUI ui = (VCTabPaneUI) pane.getUI();
                   ui.navigateSelectedTab(NEXT);
         private static class PreviousAction extends AbstractAction
              public void actionPerformed(ActionEvent e)
                   JTabbedPane pane = (JTabbedPane) e.getSource();
                   VCTabPaneUI ui = (VCTabPaneUI) pane.getUI();
                   ui.navigateSelectedTab(PREVIOUS);
         private static class PageUpAction extends AbstractAction
              public void actionPerformed(ActionEvent e)
                   JTabbedPane pane = (JTabbedPane) e.getSource();
                   VCTabPaneUI ui = (VCTabPaneUI) pane.getUI();
                   int tabPlacement = pane.getTabPlacement();
                   if (tabPlacement == TOP || tabPlacement == BOTTOM)
                        ui.navigateSelectedTab(WEST);
                   } else
                        ui.navigateSelectedTab(NORTH);
         private static class PageDownAction extends AbstractAction
              public void actionPerformed(ActionEvent e)
                   JTabbedPane pane = (JTabbedPane) e.getSource();
                   VCTabPaneUI ui = (VCTabPaneUI) pane.getUI();
                   int tabPlacement = pane.getTabPlacement();
                   if (tabPlacement == TOP || tabPlacement == BOTTOM)
                        ui.navigateSelectedTab(EAST);
                   } else
                        ui.navigateSelectedTab(SOUTH);
         private static class RequestFocusAction extends AbstractAction
              public void actionPerformed(ActionEvent e)
                   JTabbedPane pane = (JTabbedPane) e.getSource();
                   pane.requestFocus();
         private static class RequestFocusForVisibleAction extends AbstractAction
              public void actionPerformed(ActionEvent e)
                   JTabbedPane pane = (JTabbedPane) e.getSource();
                   VCTabPaneUI ui = (VCTabPaneUI) pane.getUI();
                   ui.requestMyFocusForVisibleComponent();
         * Selects a tab in the JTabbedPane based on the String of the action
         * command. The tab selected is based on the first tab that has a mnemonic
         * matching the first character of the action command.
         private static class SetSelectedIndexAction extends AbstractAction
              public void actionPerformed(ActionEvent e)
                   JTabbedPane pane = (JTabbedPane) e.getSource();
                   if (pane != null && (pane.getUI() instanceof VCTabPaneUI))
                        VCTabPaneUI ui = (VCTabPaneUI) pane.getUI();
                        String command = e.getActionCommand();
                        if (command != null && command.length() > 0)
                             int mnemonic = (int) e.getActionCommand().charAt(0);
                             if (mnemonic >= 'a' && mnemonic <= 'z')
                                  mnemonic -= ('a' - 'A');
                             Integer index = (Integer) ui.mnemonicToIndexMap
                                       .get(new Integer(mnemonic));
                             if (index != null && pane.isEnabledAt(index.intValue()))
                                  pane.setSelectedIndex(index.intValue());
         private static class ScrollTabsForwardAction extends AbstractAction
              public void actionPerformed(ActionEvent e)
                   JTabbedPane pane = null;
                   Object src = e.getSource();
                   if (src instanceof JTabbedPane)
                        pane = (JTabbedPane) src;
                   } else if (src instanceof ScrollableTabButton)
                        pane = (JTabbedPane) ((ScrollableTabButton) src).getParent();
                   } else
                        return; // shouldn't happen
                   VCTabPaneUI ui = (VCTabPaneUI) pane.getUI();
                   ui.tabScroller.scrollForward(pane.getTabPlacement());
         private static class ScrollTabsBackwardAction extends AbstractAction
              public void actionPerformed(ActionEvent e)
                   JTabbedPane pane = null;
                   Object src = e.getSource();
                   if (src instanceof JTabbedPane)
                        pane = (JTabbedPane) src;
                   } else if (src instanceof ScrollableTabButton)
                        pane = (JTabbedPane) ((ScrollableTabButton) src).getParent();
                   } else
                        return; // shouldn't happen
                   VCTabPaneUI ui = (VCTabPaneUI) pane.getUI();
                   ui.tabScroller.scrollBackward(pane.getTabPlacement());
         * This inner class is marked "public" due to a compiler bug. This
         * class should be treated as a "protected" inner class.
         * Instantiate it only within subclasses of BasicTabbedPaneUI.
         private class TabbedPaneScrollLayout extends TabbedPaneLayout
              protected int preferredTabAreaHeight(int tabPlacement, int width)
                   return calculateMaxTabHeight(tabPlacement);
              protected int preferredTabAreaWidth(int tabPlacement, int height)
                   return calculateMaxTabWidth(tabPlacement);
              public void layoutContainer(Container parent)
                   int tabPlacement = tabPane.getTabPlacement();
                   int tabCount = tabPane.getTabCount();
                   Insets insets = tabPane.getInsets();
                   int selectedIndex = tabPane.getSelectedIndex();
                   Component visibleComponent = getVisibleComponent();
                   calculateLayoutInfo();
                   if (selectedIndex < 0)
                        if (visibleComponent != null)
                             // The last tab was removed, so remove the component
                             setVisibleComponent(null);
                   } else
                        Component selectedComponent = tabPane
                                  .getComponentAt(selectedIndex);
                        boolean shouldChangeFocus = false;
                        // In order to allow programs to use a single component
                        // as the display for multiple tabs, we will not change
                        // the visible compnent if the currently selected tab
                        // has a null component. This is a bit dicey, as we don't
                        // explicitly state we support this in the spec, but since
                        // programs are now depending on this, we're making it work.
                        if (selectedComponent != null)
                             if (selectedComponent != visibleComponent
                                       && visibleComponent != null)
                                  if (SwingUtilities.findFocusOwner(visibleComponent) != null)
                                       shouldChangeFocus = true;
                             setVisibleComponent(selectedComponent);
                        int tx, ty, tw, th; // tab area bounds
                        int cx, cy, cw, ch; // content area bounds
                        Insets contentInsets = getContentBorderInsets(tabPlacement);
                        Rectangle bounds = tabPane.getBounds();
                        int numChildren = tabPane.getComponentCount();
                        if (numChildren > 0)
                             // calculate tab area bounds
                             tw = bounds.width - insets.left - insets.right;
                             th = calculateTabAreaHeight(tabPlacement, runCount,
                                       maxTabHeight);
                             tx = insets.left;
                             ty =

  • JTabbedPane detect close tab event.

    How can I get a title of tab which user just close (in JTabbedPane)?? I tried ContainerListener and componentRemoved method, but I can't get appropriate String with title.
    Any ideas?

    One way is to use a change listener:
    import java.awt.Dimension;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JTabbedPane;
    import javax.swing.event.ChangeEvent;
    import javax.swing.event.ChangeListener;
    public class GetDeletedTab
      private static JTabbedPane tabbedPane = new JTabbedPane();
      private static String[] workDays =
        "Monday", "Tuesday", "Wednesday", "Thursday", "Friday"
      private static int currentIndex = -1;
      private static int previousIndex = -1;
      private static void createAndShowUI()
        for (String day : workDays)
          tabbedPane.addTab(day, new JPanel());
        currentIndex = tabbedPane.getSelectedIndex();
        tabbedPane.addChangeListener(new ChangeListener()
          public void stateChanged(ChangeEvent e)
            int index = tabbedPane.getSelectedIndex();
            if (index != currentIndex)
              previousIndex = currentIndex;
              currentIndex = index;
              if (previousIndex != -1)
                String currTabTitle = tabbedPane.getTitleAt(currentIndex);
                String prevTabTitle = tabbedPane.getTitleAt(previousIndex);
                System.out.println("Previous Tab Title was: " + prevTabTitle );
                System.out.println("Current Tab Title is: " + currTabTitle);
                System.out.println();
        JFrame frame = new JFrame("GetDeletedTab");
        JPanel cPane = (JPanel)frame.getContentPane();
        cPane.setPreferredSize(new Dimension(600, 400));
        cPane.add(tabbedPane);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.pack();
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
      public static void main(String[] args)
        java.awt.EventQueue.invokeLater(new Runnable()
          public void run()
            createAndShowUI();
    }

  • JTabbedPane Title change

    I have a JTabbedPane with different component like txtName, cbCourse. If i edit the name of the txtName field, the corresponding name should change in the JTabbedPane title also. As of now i can update the txtName value after saving in the DB. But i want to update the txtName value in to JTabbedPane title while i edit in the txtName component. ( "txtName" is the JTextField component).

    remove the panel and set the tab with new tabname ,
    that will work .
    -MMaybe, but RTFM will yield the following, much more appropriate method:
    public void setTitleAt( int index, String title )...

  • Jtabbedpane with replacing tab content

    Hello,
    I am developing an applet that should contain a JTabbedPane with 2 tabs.
    The second tab is easy to do because ti contains one Jpanel all the way.
    the first however is an issue, because i am supposed to change its content when the applet is running.
    this means i have 3 JPanels, J1, J2, J3.
    At tge beginning the applet contains J1 in the first tab.
    and J1 contains a button. when i click that button the applet should replace J1 with J2.
    the problem is i haven't managed to find a solution yet :(
    I have tried with setvisible(false) and validate(). It won't work. I also tried to add the J2 panel over J1, but encountered no succes.
    anybody has any idea ?
    Message was edited by:
    asrfel

    If you want to change back and forth repeatedly then wrap J1/2/3 in a JPanel with a CardLayout.
    If you can discard one when it's done with, use the remove() and insertTab() methods of JTabbedPane.

  • Why isn't the selected tab title bold in JTabbedPane? How can I make it be?

    The selected tab title of JTabbedPanel is not bold. Is there a simple way to set it to be bold when a tab is selected? Thanks in advance.

    1. Simply use the HTML code in it's text like '<html><b>NameOfThisTab</b></html>'.
    2. Extend the JTabbedPane and fine-tune the font it uses.

  • How to make JTabbedPane Title component take up entire tab width?

    Starting with JDK 1.6, JTabbedPane has been enhanced to allow you to specify an arbitrary Component for the title of a tab (I think before, you could only specify a JLabel and/or icon). We make use of this in our application by specifying a Panel with a GridBagLayout and three children: an Icon (on the left), a label (middle), and a close button (right). the middle component, the label, gets all the weightx and has fill set to HORIZONTAL. Everything looks good - as long as the tabs stay on a single row. When another tab is added and the TabbedPane extends to a second row, things don't look: the tabs are allocated alot more white space now - but the Component isn't being given that extra space! Consequently, the icons on the left and right of my label stay next to the label, instead of staying next to the edges of the tab!
    Is this a bug in the JDK?
    If it's not a bug, how do I make use of all available tab space?

    Hi Darryl,
    Thanks for the suggestion. Below is a primitive standalone example. It brings up an empty frame and you can click on the "Add Tab" button to add a tab. When you do, you'll see that the tab's "title" area consists of an "i" button, a label, and a "x" button. The tab itself isn't much bigger than those three components, so things look ok. Now, add two more tabs....the 2nd tab still fits on the first row of the TabbedPane, so things still look ok. When you add the third tab, the first tab gets placed on a new 2nd row of the TabbedPane and the tab takes up the whole width of the TabbedPane....but the "i" and the "x" buttons are still scrunched up next to the label - rather than near the edges of the tab, where they would be expected.
    import java.awt.GridBagConstraints;
    import java.awt.GridBagLayout;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    public class TabExample extends javax.swing.JFrame {
        public TabExample() {
            initComponents();
         class TabRenderer extends JPanel {
              private JButton infoButton;
              private JLabel label;
              private JButton closeButton;
              public TabRenderer(String title) {
                   infoButton = new JButton("i");
                   label = new JLabel(title);
                   closeButton = new JButton("x");
                   setLayout(new GridBagLayout());
                   GridBagConstraints gc = new GridBagConstraints();
                   gc.gridy = 0;
                   gc.gridx = 0;
                   gc.anchor = GridBagConstraints.WEST;
                   gc.fill = GridBagConstraints.NONE;
                   gc.weightx = 0;
                   this.add(infoButton, gc);
                   gc.gridx = 1;
                   gc.anchor = GridBagConstraints.WEST;
                   gc.fill = GridBagConstraints.HORIZONTAL;
                   gc.weightx = 1.0;
                   this.add(label, gc);
                   gc.gridx = 2;
                   gc.anchor = GridBagConstraints.EAST;
                   gc.fill = GridBagConstraints.NONE;
                   gc.weightx = 0;
                   this.add(closeButton, gc);
        private void initComponents() {
            tabbedPane = new javax.swing.JTabbedPane();
            jButton1 = new javax.swing.JButton();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            getContentPane().add(tabbedPane, java.awt.BorderLayout.CENTER);
            jButton1.setText("Add Tab");
            jButton1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    addTabHandler(evt);
            getContentPane().add(jButton1, java.awt.BorderLayout.SOUTH);
            pack();
         private void addTabHandler(java.awt.event.ActionEvent evt) {
              int index = tabbedPane.getTabCount();
              tabbedPane.add(new JPanel(), index);
              tabbedPane.setTabComponentAt(index, new TabRenderer("Tab " + index));
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    JFrame f = new TabExample();
                        f.setSize(400, 300);
                        f.setVisible(true);
        private javax.swing.JButton jButton1;
        private javax.swing.JTabbedPane tabbedPane;
    }

  • JTabbedPane with non-tabbed text

    OK, I'm stuck (again)
    What I would like to do is have a tabbed pane (2 tabs) and then put some text (maybe in a JLable) on the same line as the tabs. I'll try to draw a picture for clearity. Anyone have any ideas about how to do this?
    / tab1 \ /tab2  \         Here is some text
    ================================
    |    This is what changes                             |
    |            when you switch tabs                     |
    |                                                                        |
    ================================I think you can get the idea from that 'picture.'

    The correct way is probably to override the TabbedPaneUI, but that too complicated for me, so here's a quick hack that might give you some ideas:
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.plaf.*;
    public class TabbedPaneWithText extends JFrame
         public TabbedPaneWithText()
              JTabbedPane tabbedPane = new JTabbedPane()
                   public void paintComponent(Graphics g)
                        super.paintComponent(g);
                        Rectangle lastTab = getUI().getTabBounds(this, getTabCount() - 1);
                        int tabEnd = lastTab.x + lastTab.width;
                        String text = "Some Text";
                        FontMetrics fm = getFontMetrics( getFont() );
                        int stringWidth = fm.stringWidth( text ) + 10;
                        int x = getSize().width - stringWidth;
                        if (x < tabEnd)
                             x = tabEnd;
                        g.drawString(text, x + 5, 18);
              tabbedPane.add("1", new JTextField("one"));
              tabbedPane.add("2", new JTextField("two"));
              getContentPane().add(tabbedPane);
         public static void main(String args[])
            TabbedPaneWithText frame = new TabbedPaneWithText();
            frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
            frame.pack();
            frame.setLocationRelativeTo( null );
            frame.setVisible(true);
    }

  • Bold lines appear around outside right edge and bottom of some pages.

    Several pages now have bold lines around outside right edge, bottom and center of document.  This bold line is also in center between pages in spread. None of the pages are showing automatic page numbers, and when I try and export to pdf, the pdf is blank. What have I done to create these bold lines?  Why are pages not showing? Why does pdf appear blank?

    Which version of ID and your OS?
    We're going to need screen captures to see what you are talking about.
    Is your content on layers marked non-printing? Does it disappear in InDesign when you switch to Preview mode?

  • Indesign Header - Running Title Overlap

    I have an Indesgin template for an academic journal that I am working on updating for this upcoming year. I did not create the template.
    The problem I have is that there is a paragraph style called Article Title that auto populates the title in the header of each page when I set the title of the article to this style. What I am running into is that when the title is long, the header title is either getting scrunched up together or it is putting all the text on one line and making it overlap and unreadable.
    Is there any way to set the header's running title to automatically wrap to a second or third line if it has too many characters for the first line?

    Hi,
    No.
    No.
    Yes … Think different!
    … I've gently done it using variable feature (… and Grep, if you want to play it in one click!)! 

  • JFrame.pack() causes problems with jtabbedpane(making new tabs)and resizing

    I have a JFrame with a JTabbedPane inside of it. Inside of each tab I put a JPanel with a JTextArea in it. When I create a new tab, I do something like textArea.requestFocusInWindow();
    However, this will not work unless I do a frame.pack() right after I created the new tab and right before that line of code.
    This in turn causes another problem. If I resize the jframe and then create a new tab, the window will snap back to the size it had before creating the tab. I assume this has to do with the pack() function, however nothing else I try will make the cursor blink in the JTextArea.
    Is there a solution to this...either something to make the cursor blink or something other than the pack function to update the JFrame?
    Thank you

    This posting should help you out:
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=581478

  • Forms 6i - Highlight a tab page label (BOLD or coloring) in a tabbed canvas

    Hi Sir,
    I have an urgent requirement wherein I need to highlight a particular tab page header (label) either via
    1. Making the tab page label BOLD
    Or
    2. Coloring that particular tab page.
    OR
    some other way.
    Could anyone please help me on this.
    Regards,
    Kiran

    No version of Oracle Forms allows you change these properties of a tabbed canvas. If you were using Forms 10g or higher, you would be able to use the Oracle Forms Look and Feel Project which is a set of JavaBeans created by Francois Degrelle and enables you the change many of the properties that Forms won't let you change. Unfortunately, you are stuck with what is available in Forms 6i.
    Craig...

  • Why does Firefox 37.0.1 show multiple overlapped tab icons + same some pdf graphics? (36.0.4 is OK)

    When running on SONY VAIO i7 WIN 7 64bit SP1 with NVIDIA GeForce GT 520M, the icons in the tabs at top of Firefox page replicate, overlapped, horizontally, offset by a few pixels in 37.0.1. Similarly, when displaying web based pdf files through Firefox 37.0.1, some graphics replicate, overlapping, vertically. There are no such problems in 36.0.4 or previous. My drivers for GeForce GT 520M are up to date, so not a driver issue. I have uninstalled 37.0.1 and reinstalled 36.0.4 until this can be fixed.

    You can try to disable hardware acceleration in Firefox.
    *Tools > Options > Advanced > General > Browsing: "Use hardware acceleration when available"
    You need to close and restart Firefox after toggling this setting.
    *https://support.mozilla.org/kb/upgrade-graphics-drivers-use-hardware-acceleration
    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem.
    *Switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance
    *Do NOT click the Reset button on the Safe Mode start window
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • Tabstrip: Protected title for tab index

    Hi all,
      This is the first time I am trying my hand on tabstrips so the problem may be elementary but I am unable to solve it. I've defined a tabstrip using the wizard with 6 tabs and when I run the program the tabstrip appears fine. But I also get a success message (00-119) 'Protected tab titles are not supported (tab & title &)'. And since this message is called dynamically, i cant determine the error cause. The tabs have name 'TABSTR01' to '06' and have been defined 'output fields' so no text(although i've tried with texts as well).
      could you please help me get rid of this message?
    Thanks
    cheers

    I hope you'd have fixed your problem by now.
    I also came up with a similar problem while creating a new infotype in HR(PD).
    I realised the cause for the problem was a call to a routine   'change_format' in program 'FH5AMF30' which is called in via the module 'Init' which is a required module in the PBO of the infotype processing screen. So I included the following code in the module 'init_9nnn' after the init module:
    module init_9nnn output.
    loop at screen.
        if screen-name = 'TAB_STRIP1_TAB1'.
          screen-input = '1'.
          modify screen.
        endif.
        if screen-name = 'TAB_STRIP1_TAB2'.
          screen-input = '1'.
          modify screen.
        endif.
        if screen-name = 'TAB_STRIP1_TAB3'.
          screen-input = '1'.
          modify screen.
        endif.
      endloop.
    endmodule.
    That solved the problem.
    The bottom line being--the Tabstrip should have a screen-input = '1' immediately before calling the subscreen in the PBO.
    Hope this helps someone in future.
    Cheers,
    Sanjay

  • Overlapping tabs (in a bad way)

    In a tabbed panel, my tabs are (accidentally) overlapping so
    that a little square or circle shows up on the tab to the left,
    indicating the start of the clickable region for the tab on the
    right. I would like to get rid of this, but am not sure what to
    adjust in the SpryTabbedPanels.css file. Here is the page:
    http://www.grad.umn.edu/gradwriting/IWP/indextest.html
    Thanks!

    There seems to be a rule in grad.css:
    ul {grad.css (line 179)
    list-style-image:url(../images/li.gif);
    margin:5px;
    That is causing the square image to appear. You can get rid
    of it by modifying this rule in SpryTabbedPanels.css:
    .TabbedPanelsTabGroup {
    margin: 0px;
    padding: 0px;
    So that it sets the list-style to none:
    .TabbedPanelsTabGroup {
    margin: 0px;
    padding: 0px;
    list-style: none;
    --== Kin ==--

Maybe you are looking for