Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am try to do 100% full screen mode, I am using Ubuntu 12.10, and on the left is the side bar and the top is the menu. When I run full screen mode it doesn't cover up those two menu bars, it sits next to them:

Screen Shot

It should cover the left menu bar and the top black bar. Anyone have any idea why it doesn't?

package sscce;

import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import javax.swing.JFrame;

public class Main extends JFrame{

    public Main(){
        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsDevice myDevice = ge.getDefaultScreenDevice();
        this.setUndecorated(true);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        myDevice.setFullScreenWindow(this);
    }

    public static void main(String[] args){
        Main main = new Main();
    }
}
share|improve this question

1 Answer 1

This is the expected behaviour. setFullScreenWindow sends a request to the OS, which returns the dimensions of the desktop: the area to the right of the launcher and beneath the menu bar.

My background is in Windows development (although I'm now learning Linux development as fast as I can), so I can't give precise details how on to change your code. But in Windows you would need various Win API calls, plus native interface through JNI/JNA, to do this. For a good article on this issue in Unity, see http://eclipseandlinux.blogspot.com/2011/12/eclipse-unity-integration-without-jna.html

If this is an app for personal use, you should of course do whatever you want. But if you are developing for other people, may I respectfully say that it's generally not a good idea to override this behaviour. How the desktop works should be viewed as a contract. Users would likely be confused and frustrated by an app that covered up their expected way of controlling their desktop.

share|improve this answer
    
This is actually a gaming library which has 2 options, 1) window mode. 2) full screen mode. setFullScreenWindow actually gets the desktop width/height, including the launcher and the menu bar and makes the window that big, but then slides it down and to the right so some of the application is now off screen. –  Ryan Naddy Dec 30 '12 at 15:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.