Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6815767

Bad parameter when calling another method in the class "SynthTabbedPaneUI"

    Details

    • Subcomponent:
    • Resolved In Build:
      b55
    • CPU:
      x86
    • OS:
      windows_xp
    • Verification:
      Verified

      Description

      FULL PRODUCT VERSION :
      java version "1.6.0_11"
      Java(TM) SE Runtime Environment (build 1.6.0_11-b03)
      Java HotSpot(TM) Client VM (build 11.0-b16, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP
      Professional
      Version 2002
      Service Pack 3

      A DESCRIPTION OF THE PROBLEM :
      I was using Substance L&F and changed yesterday for Nimbus L&F, and i saw that the vertical align of the text, in the tab (JTabbedPane), is not align correctly in the center. So i go to the code of javax.swing.plaf.synth.SynthTabbedPaneUI and saw that method:

           protected int getBaseline(int tab) {
              if (tabPane.getTabComponentAt(tab) != null ||
                      getTextViewForTab(tab) != null) {
                  return super.getBaseline(tab);
              }
              String title = tabPane.getTitleAt(tab);
              Font font = tabContext.getStyle().getFont(tabContext);
              FontMetrics metrics = getFontMetrics(font);
              Icon icon = getIconForTab(tab);
              textRect.setBounds(0, 0, 0, 0);
              iconRect.setBounds(0, 0, 0, 0);
              calcRect.setBounds(0, 0, Short.MAX_VALUE, maxTabHeight);
              >>> tabContext.getStyle().getGraphicsUtils(tabContext).layoutText(
                      tabContext, metrics, title, icon, SwingUtilities.CENTER,
                      SwingUtilities.CENTER, SwingUtilities.LEADING,
                      SwingUtilities.TRAILING, calcRect,
                      iconRect, textRect, textIconGap);
              return textRect.y + metrics.getAscent() + getBaselineOffset();
          }


      And the call of the method have a bad parameter:

      tabContext.getStyle().getGraphicsUtils(tabContext).layoutText(
                      tabContext, metrics, title, icon, SwingUtilities.CENTER,
                      SwingUtilities.CENTER, SwingUtilities.LEADING,
                      >>SwingUtilities.TRAILING<<, calcRect,
                      iconRect, textRect, textIconGap);

      The method need :

      layoutText(SynthContext ss, FontMetrics fm,
                               String text, Icon icon, int hAlign,
                               int vAlign, int hTextPosition,
                               >>int vTextPosition<<, Rectangle viewR,
                               Rectangle iconR, Rectangle textR, int iconTextGap)

      And vTextPosition dont have SwingUtilities.TRAILING in it options...so it must bee SwingUtilities.CENTER, no? VerticalTextPosition only receive SwingUtilities.BOTTOM, SwingUtilities.CENTER or SwingUtilities.TOP...

      So the parameter SwingUtilities.TRAILING is wrong, and it making the text to align in BOTTOM ... can you fix it to SwingUtilities.CENTER? Thanks.


      REPRODUCIBILITY :
      This bug can be reproduced always.

        Attachments

          Activity

            People

            • Assignee:
              peterz Peter Zhelezniakov (Inactive)
              Reporter:
              ndcosta Nelson Dcosta (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: