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

(macos) JMenuItem is not shown under fullscreen mode

    XMLWordPrintable

    Details

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Mac OS X 10.12.6 + JDK16.0.1

      A DESCRIPTION OF THE PROBLEM :
      I develop SWING application on JDK1.6.0 and Mac OS X, and JMenuItem shows under fullscreen, but the application build on JDK16.0.1 and Mac OS X don't show JMenuItem under fullscreen.



      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Please run under programs.

      step 1. push full screen button
      step 2. select file menu

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      At the step 2, displays quit submenu.
      ACTUAL -
      At the step 2, displays none.

      ---------- BEGIN SOURCE ----------
      import java.awt.BorderLayout;
      import java.awt.Dimension;
      import java.awt.GraphicsEnvironment;
      import java.awt.Rectangle;
      import java.awt.event.ActionEvent;
      import java.awt.event.ActionListener;

      import javax.swing.JButton;
      import javax.swing.JFrame;
      import javax.swing.JMenu;
      import javax.swing.JMenuBar;
      import javax.swing.JMenuItem;

      @SuppressWarnings("serial")
      public class MenuTest extends JFrame {

      private static MenuTest menuTest;

      public static void main(String[] args) {
      javax.swing.SwingUtilities.invokeLater(new Runnable() {
      public void run() {
      createAndShowGUI();
      }
      });
      }

      private static void createAndShowGUI() {
      menuTest = new MenuTest();
      menuTest.setSize(640, 480);
      menuTest.setVisible(true);
      }

      public MenuTest() {
      super(GraphicsEnvironment.getLocalGraphicsEnvironment()
      .getDefaultScreenDevice().getDefaultConfiguration());

      this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      JMenuBar menuBar = new JMenuBar();

      // faile menu
      JMenu menu = new JMenu("File");
      JMenuItem menuItem = new JMenuItem("Quit");
      menuItem.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent arg0) {
      System.exit(0);
      }
      });
      menu.add(menuItem);
      menuBar.add(menu);

      // view menu
      JButton button = new JButton("Full Screen");
      button.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent arg0) {

      menuTest.setVisible(false);
      menuTest.dispose();
      menuTest.setUndecorated(true);
      Rectangle rect = GraphicsEnvironment
      .getLocalGraphicsEnvironment().getDefaultScreenDevice()
      .getDefaultConfiguration().getBounds();
      menuTest.setPreferredSize(new Dimension(rect.width, rect.height));
      GraphicsEnvironment.getLocalGraphicsEnvironment()
      .getDefaultScreenDevice().setFullScreenWindow(menuTest);
      menuTest.setVisible(true);
      }
      });
      this.add(button, BorderLayout.WEST);
      button = new JButton("Window");
      button.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent arg0) {

      menuTest.setVisible(false);
      menuTest.dispose();
      menuTest.setUndecorated(false);
      menuTest.setPreferredSize(new Dimension(640, 480));
      menuTest.setVisible(true);
      }
      });
      this.add(button, BorderLayout.EAST);
      this.setJMenuBar(menuBar);
      }
      }

      ---------- END SOURCE ----------

      FREQUENCY : always


        Attachments

        1. Full-Screen-JDK-160.png
          Full-Screen-JDK-160.png
          21 kB
        2. Full-Screen-JDK-17-ea.png
          Full-Screen-JDK-17-ea.png
          17 kB
        3. JDK16-screen-shot.png
          JDK16-screen-shot.png
          4.91 MB
        4. JDK-version.png
          JDK-version.png
          88 kB
        5. OS_version.png
          OS_version.png
          118 kB

          Activity

            People

            Assignee:
            psadhukhan Prasanta Sadhukhan
            Reporter:
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated: