I have the following swing code :
import java.awt.Dimension;
import java.awt.GraphicsEnvironment;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingUtilities;
public class JFrameDemo {
private JFrame jframe = new JFrame();
public JFrameDemo() {
jframe.setSize(new Dimension(800, 20));
jframe.setUndecorated(true);
jframe.getContentPane().add(new JLabel("xxxxxxxxxxx"));
jframe.setVisible(true);
jframe.setAlwaysOnTop(true);
jframe.setLocation(0, 0);
GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
jframe.setMaximizedBounds(env.getMaximumWindowBounds());
jframe.toFront();
jframe.repaint();
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
new JFrameDemo();
}
});
}
}
My jframe
window is always on top and also in the top of the screen but when other window from os ,like a browser window, is maximized my jframe
overlaps that window .
When any os windows are maximized to be maximized below my jframe
window.
you can see:
WRONG Behavior

GOOD Behavior

Since I understood java has no support for that feature so I am asking now if exists any native library which should I load using the jni.