You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@netbeans.apache.org by Zulfi Khan <zu...@yahoo.com.INVALID> on 2022/03/18 23:30:52 UTC
How to create JDialog derived class using Apache Netbeans ID 13
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.
Re: How to create JDialog derived class using Apache Netbeans ID 13
Posted by antonio <an...@vieiro.net>.
Hi Zulfi,
You can take a look at the following tutorials:
https://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html
https://netbeans.apache.org/kb/docs/java/gui-functionality.html
Hope this helps,
Antonio
El 19/3/22 a las 0:30, Zulfi Khan escribió:
> How to create SampleDialog class derived from JDialog implemnting
> ActionListener
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
For additional commands, e-mail: users-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists