各位大虾:
    请问如何让一个JDialog窗体在打开后一直是最前窗体,不会因为alt-tab什么的而隐掉
因为没有固定的父类来super()。谢谢!!

解决方案 »

  1.   

    用这么一个Contructor: public YourDialog(Frame parent)
    {
      super(parent, true);
      // your code...
    }
      

  2.   

    public YourDialog(Frame parent)
    {
      super(parent, true);
      // your code...
    }
    这样不行啊,他只能跟注一个父窗体,可是我现在没有固定的父窗体怎么办?我的意思是这个Jdialog要一直在最前面。不会因为开别的窗体而隐到后面。还请各位帮忙,谢谢!
      

  3.   

    jDialog.addWindowFocusListener(new WindowAdapter(){
     public void windowLostFocus(WindowEvent e){
     e.getWindow().toFront();
     }
    });
      

  4.   

    JDialog
    public JDialog(Dialog owner,
                   String title,
                   boolean modal)
            throws HeadlessException
    Creates a modal or non-modal dialog with the specified title and the specified owner frame. 
    This constructor sets the component's locale property to the value returned by JComponent.getDefaultLocale. 
    Parameters:
    owner - the non-null Dialog from which the dialog is displayed
    title - the String to display in the dialog's title bar
    modal - true for a modal dialog, false for one that allows other windows to be active at the same time 用模态窗口吗?
      

  5.   

    public SendAndReceiveMessageDialog(Frame frame, String title, boolean modal) {
        super(frame, title, modal);
        initialize();//构造对话框
      }
      public SendAndReceiveMessageDialog() {
        this(frame,"", false);
      }frame是你弹出对话框的父窗体.  这个Jdialog会一直在最前面。不会因为开别的窗体而隐到后面
      

  6.   

    public SendAndReceiveMessageDialog() {
        this(frame,"", false);
      }frame这个frame为null好像也可以的.
      

  7.   

    有这么个属性 alwaysOnTop 设为 true 就行。试试setalwaysOnTop()