Hey everyone,I'm trying to fetch all currently available resolutions of the screen. The problem: I'm only getting the active screen resolution (on Linux). the following code works on Mac & Windows but not on Linux:

Sorry to say that but AWT has some bugs and limitations, not only under GNU Linux. I get all screen resolutions with NEWT (JOGL 2.0). NEWT will even support XrandR 1.3 soon which means that it will be able to expose a lot more information about virtual and physical screens/monitors. Maybe this limitation has disappeared in JavaFX, look at the class javafx.stage.Screen.

Edit.: I think that your code doesn't look at all cases, it can be fixed...

My experience is that it is indeed unpredictable, probably requiring some low level wizardry to get actual results, which kind of defeats the multi-platform approach.

I did some research trying to determine the screen rotation angle, which lead me to compiling system-dependent libraries that would query the information from the system.

Something worth noting I found was that even on the official libraries, many low level features are just ignored. The rotation parameter, for example, was ignored as it wasn't completely reliable (driver issues) and wasn't very important when implemented.

With this, what I'm trying to say is that, if accessing system configuration parameters is crucial, you can't really rely on standard multi-platform libraries entirely, if only because time constraints (deadlines) probably mean the developers couldn't fit everything in.

Something worth noting I found was that even on the official libraries, many low level features are just ignored. The rotation parameter, for example, was ignored as it wasn't completely reliable (driver issues) and wasn't very important when implemented.

With this, what I'm trying to say is that, if accessing system configuration parameters is crucial, you can't really rely on standard multi-platform libraries entirely, if only because time constraints (deadlines) probably mean the developers couldn't fit everything in.

@myrealitydeOh, by the way, here's the output for my laptop running Ubuntu 12.04:

1 2 3 4 5 6 7 8 9 10 11

// Recover the Graphics Environment (usually no need to store it, but just being verbose for clarity)java.awt.GraphicsEnvironmentlocalEnvironment = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment();

This is the result. The first list is a log of all the graphics modes (my laptop only returns a single device), and then the first log of the many graphics configurations (didn't want to post them all).

Note that I parse the data a bit, you can't just .toString() this stuff.

I don't know what you have chosen to hide when using AWT but NEWT is able to return the size of the physical/virtual monitor in mm, the rotation (more useful for tablets), ... and it has a really reliable full screen support under GNU Linux

Been checking NEWT. It's part of JOGL right? Is there a stand-alone version that can be plugged in into something else?

Yes NEWT is a "part" of JOGL but you can use GLG2D with it if you want to use Java2D for example. NEWT is very cross-platform, it works under Android too and at least one developer has worked for some months to port it to iOS.

On linux you will often need some mode lines in your xorg config file. Since these days there isn't one. You end up with just one valid mode, the current one. I have always had to add modelines when i want to use more than the current mode on my linux distros with nvidia drivers.

I have no special talents. I am only passionately curious.--Albert Einstein

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org