Question

i'm traying a jdialog on linux, but it still appears in my taskbar. this is the code? what's wrong?

import javax.swing.JDialog;

public class Main {
    public static void main(String [] args) {
        new mydialog();
    }

    private static class mydialog extends JDialog {
        public mydialog() {
            super();
            setSize(200,200);
            setLocationByPlatform(true);
            setAlwaysOnTop(false);
            setUndecorated(true);
            setVisible(true);
        }
    }
}
Was it helpful?

Solution 4

the only solution I found is to switch from Swing interfaces to gtk interfaces, to do this I used java-gnome. the only problem is that you must change all components of the swing classes to the corresponding gtk classes.

OTHER TIPS

Since this still seems to be an issue in Linux environments I'd like to share my solution for this topic:

I simply had to create the JDialog with an parent Frame/Window like "new JDialog(new JFrame());" and after setting the JDialog to be Visible I call "jframe.revalidate();". Thats it. Looks like Java has a problem communicating correctly with the DisplayManager while initialising the JDialog..

Works for me with Java 1.8.0.45, Linux Mint 17.1, Cinnamon 2.4.8

try replacing setLocationByPlatform(true); with setLocation(10, 10);

You need to use JWindow if you don't want it to appear in the taskbar.
See also: how-do-i-prevent-jdialog-from-showing-in-gnome-panellinux

Been struggling with this one for some time now. What finally worked for me:

JDialog frame = new JDialog();
frame.setType(javax.swing.JFrame.Type.POPUP);

Alternatively you can try set the type to UTILITY.

Lubuntu 15.04 (LXDE) running Java 1.8.0_25

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top