I am troubling at GUI position of my application. That means in Linux (Centos 6) it's appear correctly from above task bar but in windows 8.1 it's appearing behind the task bar from the bottom of screen. What may would be the issue ?
I am using following code for set dimensions. (I have attached screens below)
UiConfig.getInstance().bottomRightUI(dispalyWidth, displayeHeight);
setBounds(UiConfig.getInstance().getX(), UiConfig.getInstance().getY(),
dispalyWidth, displayeHeight);
Following class used for obtain dynamic dimension from current screen
public class UiConfig {
private static final UiConfig instance = new UiConfig();
public static UiConfig getInstance() {
return instance;
}
public void bottomRightUI(int width, int height) {
x = (int) ((screen_width - width));
y = (int) ((screen_height - height));
}
public int getX() {
return this.x;
}
public int getY() {
return this.y;
}
}
On Linux
On Windows
To achieve task bar transparency on Windows, it needs to report the desktop size as "without the taskbar" to have pixels to mix with the alpha channel of the taskbar. When you set the task bar to be non-transparent, you'll get the behavior you desire.
Swing / Java is being fed the numbers on the screen dimensions by the operating system, and if it is fed a set of numbers, it will use them as it's been instructed.
The only fix for this would be to write custom "operating system" detecting code, custom "task bar" detecting code for the problematic operating systems, and write swing reconfiguration routines to "adjust" the dimensions to a smaller footprint despite what the operating system is reporting the footprint is. This kind of code is highly non-portable, and certainly wasn't needed when Swing was created, so it's not in Swing natively.