How to createSampleDialog class derived from JDialog implemnting ActionListener



 I want to create a JDialog derived class implementing ActionListener. The code 
is given below:

class SampleDialog extends JDialog implements ActionListener{
    JTextField tf1 = new JTextField(10);
    SampleDialog(JFrame parent, String title){
        super(parent, title, false);
        setLayout(new FlowLayout());
        setSize(300, 200);
        setTitle("OOP Project Spring, 2019, TTU");
        JButton addBtn = new JButton("Add"); 
        add(addBtn);
        add(tf1);
        addBtn.addActionListener(this);
    }
 public    void actionPerformed(ActionEvent evnt){
        String str = tf1.getText();
   JOptionPane.showMessageDialog(null, "Text Field Contained" + str);
    }
}

My application name is MenuDlg. I am cliclking on its icon but it shows me the 
option to create a Jframe class, Java class, java package, Java interface and 
so on but there is no option to create the JDialog derived class   implementing 
actionListener. Please guide me. I want to execute the SampleDialog using a 
menuitem.
Please guide me.
I can't take the screen shot when I am opening the Project->New->popup dialog 
box.
Zulfi.

Reply via email to