Can you put JFrames inside Full Screen Exclusive Mode?


To be honest, I didn't quite know how to express my question in the title. So if someone has a clearer idea of what i'm trying to ask, then please be so kind as to edit it, for the greater good of mankind.

I have the following code:

public class Main { public static void main(String[] args) { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice gd = ge.getDefaultScreenDevice(); JFrame frame = new JFrame(); Window window = new Window(frame); JButton btn = new JButton("Quit"); window.add(btn); if(gd.isFullScreenSupported()) gd.setFullScreenWindow(window); btn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice gd = ge.getDefaultScreenDevice(); gd.setFullScreenWindow(null); } }); }


What I want to do is make a library system, illustrated in full screen mode. Inside the full screen mode, there should be simple frame windows with text fields in them and so on... No heavy 2D/3D graphics required here...

My problem is, the quit button is resized to fit the entire screen. I've tried to use setBounds, setSize, etc, on the frame, window and even button... But it doesn't seem to let me be able to center the button in the middle.

So my question: Is it possible to make JFrame application windows inside a JFrame application window which is set to full screen exclusive mode? Or is it only possible to use full screen exclusive mode together with 2D/3D methods like drawing?

Note: The only thing I intend to use full screen mode for is to set it to a black background, and have a Jframe window ontop of this black background in the center of the application. It is to give the illusion that the application is actually a system.

Thank you.

P.S. please note that the quit button was merely for my own testing purposes. It won't be part of the actual system, so my question does not revolve around how to resize this particular quit button.


Fullscreen Exclusive Mode is not meant to have Swing components inside. It is meant as a high performance way to draw graphics in Java (and can benefit as much as possible of underlaying hardware if done right).

What you want to do could be done by using an undecorated <a href="http://docs.oracle.com/javase/6/docs/api/javax/swing/JDesktopPane.html" rel="nofollow">JDesktopPane</a> and maximize it over the dimensions of the screen. Then proceed with using a <a href="http://docs.oracle.com/javase/6/docs/api/javax/swing/JInternalFrame.html" rel="nofollow">JInternalFrame</a> to have a JFrame like window inside that JDesktopPane.

I've included links to the respective API sections, they should get you started.


I think that what you are after is an MDI Application. If that is what you are after you could take a look <a href="http://gilbertadjin.wordpress.com/2009/03/14/creating-mdi-applications-in-java-using-netbeans/" rel="nofollow">here</a>.


Your problem is that you do not use layout manager correctly. Learn about layout managers - the modules that put and size/resize the visual components on screen. Then decide how do you want your button to look like and then decide which layout manager to use. It will do its job.


You know what i also had the exact same problem and the only thing i know from my experience is that you can use jinternal frame and set its property undecorated to true then add your custom title bar according to your requirement.


  • xfbml like button hide the possibility to add a comment to the like
  • Why are mocking test frameworks helpful?
  • Vaadin -layout resizing overlaps
  • Has anyone used the “selection preferences” provided by MKS Yacc?
  • How to call a generic method with type constraints when the parameter doesn't have these constr
  • Programatically modify Eclipse workspace and CDT options from a plugin
  • How to check if a Gmail label has a nested sub-label?
  • You tube videos are not playing
  • my tic-tac-toe program in matlab does not work [closed]
  • Cross platform UI spacing/padding
  • How to draw a line dynamically in android [duplicate]
  • Blackberry 6: how to detect a long click on track pad?
  • Getting media player state in windows phone 7
  • Application level floating views with navigation in Android
  • AndEngine Applying Transparancy to AndEngine View
  • Using a canvas object in a thread to do simple animations - Java
  • Unable to install Git-core+svn by MacPorts
  • Django simple Captcha “No module named fields” error
  • How do I get HTML corresponding to current DOM tree?
  • print() is showing quotation marks in results
  • Make VS2015 use angular-cli ng at build time in a .NET project
  • Combining SpatialPolygonsDataFrame of two neighbour countries
  • Could not find rake using whenever rails
  • Android fill_parent issue
  • Avoid links criss cross / overlap in d3.js using force layout
  • How to make a tree having multiple type of nodes and each node can have multiple child nodes in java
  • Get object from AWS S3 as a stream
  • Does CUDA 5 support STL or THRUST inside the device code?
  • How to show dropdown in excel using jrxml (jasper api)?
  • Timeout for blocking function call, i.e., how to stop waiting for user input after X seconds?
  • Why winpcap requires both .lib and .dll to run?
  • Linker errors when using intrinsic function via function pointer
  • Windows forms listbox.selecteditem displaying “System.Data.DataRowView” instead of actual value
  • Proper folder structure for lots of source files
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • Can Visual Studio XAML designer handle font family names with spaces as a resource?
  • How does Linux kernel interrupt the application?
  • LevelDB C iterator
  • reshape alternating columns in less time and using less memory
  • How can i traverse a binary tree from right to left in java?