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

Fullscreen windows behind the taskbar on Linux

XMLWordPrintable

    • x86
    • linux

      FULL PRODUCT VERSION :
      1.6.0-rc.b104

      ADDITIONAL OS VERSION INFORMATION :
      Linux 2.6.18-1.2798.fc6

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Window manager Gnome

      A DESCRIPTION OF THE PROBLEM :
      When putting a JFrame in fullscreen exclusive mode following the java tutorial the frame is displayed in fullscreen but below the taskbar.

      Nevertheless not set the resizable property of the JFrame to false made it appears above the taskbar.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Simply use GraphicsDevice.setFullScreenWindow with a JFrame on which resizable property was set to false.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The frame should be fullscreen and "on top" of any other windows.
      ACTUAL -
      The frame is displayed below the taskbar.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      No error message.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------

      public class ScreenManager
      {
          // -----------------------------------------------------------------------------
          // STATIC ATTRIBUTES
          // -----------------------------------------------------------------------------
          private static ScreenManager s_instance = null;
          
          private static Logger s_logger = Logger.getLogger( "ScreensManager" );
          
          // -----------------------------------------------------------------------------
          // ATTRIBUTES
          // -----------------------------------------------------------------------------
          private GraphicsEnvironment m_gEnv;
          
          private GraphicsDevice m_gDevice;
          
          // -----------------------------------------------------------------------------
          // CONSTRUCTOR
          // -----------------------------------------------------------------------------
          /**
           * Default private constructor.
           */
          private ScreenManager()
          {
              m_gEnv = GraphicsEnvironment.getLocalGraphicsEnvironment();
              m_gDevice = m_gEnv.getDefaultScreenDevice();
              
              s_logger.info( "Plein écran supporté = "
                      + m_gDevice.isFullScreenSupported() );
          }
          
          /**
           * Retrieves single instance of ScreensManager
           * @return The unique instance of ScreensManager
           */
          public static ScreenManager getInstance()
          {
              if( s_instance == null )
              {
                  s_instance = new ScreenManager();
              }
              
              return s_instance;
          }
          
          // -----------------------------------------------------------------------------
          // METHODS
          // -----------------------------------------------------------------------------
          /**
           * Toggles the display of given JFrame in fullscreen mode.
           * TODO : perform a check in this method to see if fullscreen is enabled
           * @param frame frame to switch in full screen mode
           */
          public void setFullScreen( JFrame frame )
          {
              try
              {
                  m_gDevice.setFullScreenWindow( frame );
              }
              finally
              {
              }
          }
          
          /**
           * Revert fullscreen mode off.
           */
          public void unFullScreen()
          {
              m_gDevice.setFullScreenWindow(null);
          }
      }

      //--------------------------------------------------------------------------------------------//
      //--------------------------------------------------------------------------------------------//
      //--------------------------------------------------------------------------------------------//

      import java.awt.BorderLayout;
      import java.awt.DisplayMode;
      import java.awt.Graphics;
      import java.awt.GraphicsEnvironment;
      import java.awt.Point;
      import java.awt.event.ActionEvent;
      import java.awt.event.ActionListener;
      import javax.swing.JButton;
      import javax.swing.JFrame;
      import javax.swing.SwingUtilities;


      public class ScreenTest extends JFrame
      {
          public ScreenTest()
          {
              setLayout( new BorderLayout() );
              
              JButton quit = new JButton("Quit");
              quit.addActionListener( new ActionListener()
              {
                  public void actionPerformed(ActionEvent e)
                  {
                      ScreenManager.getInstance().unFullScreen();
                      
                      System.exit( 0 );
                  }
              } );
              
              add( quit, BorderLayout.CENTER );
              
              setUndecorated( true );
              
              // Will appear below the taskbar if set to false
              setResizable( false );
              
              setVisible( true );
              
              pack();
              
              ScreenManager.getInstance().setFullScreen( this );
          }
          
          public static void main(String[] args)
          {
              SwingUtilities.invokeLater( new Runnable()
              {
                  public void run()
                  {
                      new ScreenTest();
                  }
              } );
          }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Don't call setResizable( false ), but it's against java tutorial recommandations.

            art Artem Ananiev (Inactive)
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: