Go to content Go to navigation Go to about page Go to archive

Java AWT/Swing: Fullscreen · 17 March 2006 by

Today I had faced a problem with creating fullscreen AWT/Swing windows or frames. Some Googling solved my problem, but it was not trivial as it looks first.

Trival part: setting Frame/JFrame fullscreen with GraphicsDevice’s setFullScreenWindow(Frame f) function.

So first one would extend a Frame, and adding this small snippet:

GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
gd.setFullScreenWindow(this);

It will work, however, the border will be still there. Also note that setFullScreenWindow will move to 0,0 and resize to fit screen in case of no full screen suppport present (you can check for this with isFullScreenSupport()). Removing decorations can be achieved by setResizable(false) and setUndecorated(true).

However, setUndecorated() works only when Frame is not displayable (check with isDisplayable()), thus if you extend one, it will fail. You need to instantiate a new frame and calling this method before setVisible().

Now we have:

Frame fr = new Frame();
fr.setResizable(false);
if (!fr.isDisplayable()) fr.setUndecorated(true);
// GraphicsDevice… (the same as above)
gd.setFullScreenWindow(fr);
fr.setVisible(true);

In theory this should be working, however, on MacOSX Tiger, the primary platform I do Java coding (on Linux I do C) this code still leaves the decorations on and displays a black block instead the Mac menubar. This was solved with adding implicit size definitions, such as fr.setSize(1024, 768) and fr.setLocation(0, 0).

I also tried the same codes on Windows, and the same states happened. Defining the size makes it working.

Note: on Mac the apple.awt.fakefullscreen property can be turned true for development purposes, it will mimic fullscreen functionality to the code, but still display a frame thus the application can be killed with a mouse.

DVB-MHP: my first steps · 2 September 2005 by

My new project is about making MHP usable under Linux, or generally in an open source way.

Search results: two different open sourced implementation projects, both of them are very incomplete. One of them even calls itself “emulator” and not platform implementation.

These two projects are OpenMHP and XleTView. The latter is the emulator one, it even uses Javassist for in-memory bytecode modification (possibly removing non present class calls), while the first one aims to be a complete implementation, however at least 40% of the havi.ui classes (for user interface interaction) are just stubs.

Also there is a site called ‘Interactive TV Web’, which has sources codes, examples, links and some explanations. The codes are mostly public domain or education only.

More to come.

Links: