Reputation: 3566
In Ubuntu (actually in unity), I can't make swing's JFrame's fullscreen. I've tried lots of ways written in stackoverflow but noone of them worked for me.
I'm trying to develop a game and I need to see nothing but my game on my screen. However, ubuntu forces me to display Unity Launcher and the menubar(Clock, wifi icon, etc..) above.
How can I run my Java programs in fullscreen mode? Here's my code:
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import javax.swing.JFrame;
public class Starter extends JFrame {
private static final long serialVersionUID = -2656706278597877008L;
public static void main(String[] args) {
new Starter();
}
public Starter() {
super(UIConstants.FRAME_TITLE);
setResizable(false);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setUndecorated(true);
makeFullScreen();
setVisible(true);
}
private void makeFullScreen() {
GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice device = env.getDefaultScreenDevice();
device.setFullScreenWindow(this);
}
}
And this program is seen as follows:
Upvotes: 2
Views: 759
Reputation: 26
you can't remove the global menu or place a window on top of it, simply, change the theme to another like: lxde
Upvotes: 1