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

REGRESSION: MenuBar behaves incorrectly sometimes



    • Subcomponent:
    • CPU:
    • OS:


      Name: iaR10016 Date: 11/23/2003

      Filed By : J2SE-SQA [###@###.###
      JDK : JDK1.5.0-b28, JDK1.5.0-b26 (not reproducible with jdk1.4.2-b28)
      JCK : JCK1.5-runtime (b08)
      Platform[s] : all
      switch/Mode : default
      JCK test owner: http://javaweb.eng/jck/usr/owners.jto
      Falling test : api/java_awt/interactive/MenuBarTests.html#MenuBarTests [MenuBarTest0001]

      Java TM 2 Platform Std. Ed. v1.5.0 (b28) reads about java.awt.MenuBar.setFont(Font) method
      (inherited from class java.awt.MenuComponent):
      public void setFont(Font f)

      Sets the font to be used for this menu component to the specified font. This font is also used
      by all subcomponents of this menu component, unless those subcomponents specify a different font.

      Some platforms may not support setting of all font attributes of a menu component; in such cases,
      calling setFont will have no effect on the unsupported font attributes of this menu component.
      Unless subcomponents of this menu component specify a different font, this font will be used by
      those subcomponents if supported by the underlying platform.

      I have found some inexactnesses in java.awt.MenuBar class implementation. If MenuBar behavior
      described in this bug report is correct, it will be better to reflect it in API Specification.

      Please, run the script from "How to reproduce" section on the different platforms and with
      different toolkits (XToolkit/MToolkit) and play with tested MenuBar component:

      1. On Windows systems (tested on Windows XP, Windows 2000) menu font changes as expected both for
      menu items and menu header if it is "Dialog, 17, Plain". However, it does not work if font size is
      big enougth: for example, the font is correct for menu items, but unexpectedly small for menu header
      if I set font properties to "Dialog, 24, Plain".

      On Linux and Solaris platforms (tested on Solaris 10 sparc/Gnome2, Solaris 10 x86/CDE,
      Suse Linux 8.1/Gnome2, RedHat Adv. Server 2.1/Gnome) menu header font does not change at all with
      XToolkit, but changes correctly with MToolkit (please, note that XToolkit is a default toolkit now).
      In the same time, menu item font changes correctly with both toolkits.

      2. Please, select "setHelpMenu" switch and then click "Add" button. It is expected that Help menu
      appears at the top right corner of the frame, but this is not true for MToolkit (Solaris/Linux
      systems): actually it appears in the same place as the usual menu. If I deselect "setHelpMenu" and
      add several non-help menus, help menu does not remain the rightest as expected: it behaves as usual
      menu instead.

      3. Please, add several menus and Help menu and then resize the tested frame on Solaris/Linux with
      XToolkit: when all the memus do not fit in the tested window, Help menu overlaps one of the other
      menus. On Windows MenuBar just change its height so all the menus fit in the tested frame in this case
      (this is OK), and on Solaris/Linux with MToolkit some menus become invisible so that help menu does
      not overlap anu menu in MenuBar.

      4. Please, add several menus and resize the tested frame. When all the menus do not fit in the tested
      window try to select one of them and then click "Left" or "Right" keys several times. It is expected that
      when the rightest visible menu becomes selected and the user click "Right" key the cursor remains on the
      same place and menus shifts left, so the next menu becomes visible and selected. But it does not happen
      with MToolkit: if the tested Window is too narrow and some menu is not visible, it is impossible to
      select such menu. It does not happen with XToolkit, however I am not sure that MenuBar behaviour is
      correct in this case.

      Test source location:

      jtr file location:

      How to reproduce:
      Run the following script (you may need to change its variables)

      --- script start ---

      #Paths in Java Software:

      #Alternative paths outside Java Software:

      export CLASSPATH="$JCK/classes:$JCK/lib/javatest.jar"
      #export AWT_TOOLKIT=XToolkit
      #export AWT_TOOLKIT=MToolkit

      $JDK/bin/java javasoft.sqe.tests.api.java.awt.interactive.MenuBarTests -TestCaseID MenuBarTest0001
      --- script end ---

      Specific machine info:
      Hostname: linux-24
      OS: RedHat Advanced Server 2.1 (Gnome)



          Issue Links



              bchristi Brent Christian
              irasunw Ira Ira (Inactive)
              0 Vote for this issue
              0 Start watching this issue