开发者

java jdialog taskbar button

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(开发者_如何学JAVA);
            setSize(200,200);
            setLocationByPlatform(true);
            setAlwaysOnTop(false);
            setUndecorated(true);
            setVisible(true);
        }
    }
}


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


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜