Java netbeans平台旧对话框如何获取应用程序()

Java netbeans平台旧对话框如何获取应用程序(),java,netbeans-platform,Java,Netbeans Platform,我正在将一个现有的应用程序移植到netbeans平台,虽然我可能会将一些现有的对话框更改为新的notify方法,但有些对话框非常复杂(多个面板等),我宁愿不移植它们,至少现在还不。我发现了如何获取主机 mainFrame = (JFrame) WindowManager.getDefault().getMainWindow(); 但是我不知道.getApplication().show()使用什么 Sst01App当然不存在于我的新Netbeans平台应用程序中,我似乎找不到该应用程序

我正在将一个现有的应用程序移植到netbeans平台,虽然我可能会将一些现有的对话框更改为新的notify方法,但有些对话框非常复杂(多个面板等),我宁愿不移植它们,至少现在还不。我发现了如何获取主机

   mainFrame = (JFrame) WindowManager.getDefault().getMainWindow(); 
但是我不知道.getApplication().show()使用什么


Sst01App当然不存在于我的新Netbeans平台应用程序中,我似乎找不到该应用程序(我想我尝试了所有的变量)

经过大量搜索后,在DialogDescriptor文档下找到了它

在我发现如何创建可以装饰的自定义对话框时,.show()方法仍然是个问题,但我发现DialogDisplayer可以与我创建的对象一起工作。就这样

Dialog sb2Dlg=DialogDisplayer.getDefault().createDialog(sb2)

在无边界和全屏上仍然有很多乐趣,但这是另一个话题

class MyPanel extends javax.swing.JPanel implements java.awt.event.ActionListener { 
   //buttons, fields, labels, etc.
    ... 

   public void requestFocus () { //set focus for one components 
        myField.requestFocus (); 
   }
    ...
   public void actionPerformed(final java.awt.event.ActionEvent ap) { // handling code for buttons
    ...
   }
}
MyPanel mp = new MyPanel(); // create new MyPanel 
Object [] options =  {  new JButton ("Choice 1"), 
                    new JButton ("Choice 2")};
DialogDescriptor dd = new DialogDescriptor (mp, 
                        "Text in title", 
                         true, 
                         options, 
                         null, 
                         DialogDescriptor.DEFAULT_ALIGN, 
                         null, 
                         mp); //create new modal DialogDescriptor with defined ActionListener 
mp.requestFocus(); // set focus to component which was specified in MyPanel's         requestFocus() method 
TopManager.getDefault ().createDialog (dd).show (); //show dialog
class MyPanel extends javax.swing.JPanel implements java.awt.event.ActionListener { 
   //buttons, fields, labels, etc.
    ... 

   public void requestFocus () { //set focus for one components 
        myField.requestFocus (); 
   }
    ...
   public void actionPerformed(final java.awt.event.ActionEvent ap) { // handling code for buttons
    ...
   }
}
MyPanel mp = new MyPanel(); // create new MyPanel 
Object [] options =  {  new JButton ("Choice 1"), 
                    new JButton ("Choice 2")};
DialogDescriptor dd = new DialogDescriptor (mp, 
                        "Text in title", 
                         true, 
                         options, 
                         null, 
                         DialogDescriptor.DEFAULT_ALIGN, 
                         null, 
                         mp); //create new modal DialogDescriptor with defined ActionListener 
mp.requestFocus(); // set focus to component which was specified in MyPanel's         requestFocus() method 
TopManager.getDefault ().createDialog (dd).show (); //show dialog