I can easily detect the screen orientation by doing the following:
int height = GraphicsEnvironment.getDefaultScreenDevice().getDisplayMode().getHeight();
int width = GraphicsEnvironment.getDefaultScreenDevice().getDisplayMode().getWidth();
String orientation = height/width >= 1? "Portrait" : "Landscape";
The problem is that I can’t know if the screen has been turned 90º, -90º or 180º.
I came unto this problem testing fullscreen mode on my portrait-oriented monitor, and finding out that all the input (mouse) is rotated. Knowing the angle is necessary thus to filter the input correctly.
From what I’ve seeing googling around, mobile platforms like Android have an actual .getRotation() method. How can I check this on standard Java?
Library independence is appreciated if possible