0

I am using Netbeans. I have one JFrame with JMenu, and one JDialog. I want to show the dialog when i click the menu, but it doesn't work. I only wrote this codes to my jframe and i didn't add or change any codes on the dialog:

private void jMenu1ActionPerformed(java.awt.event.ActionEvent evt)
{
   frm_edi ed= new frm_edi(this,true);
   ed.setVisible(true);
}

Help me please. Or if you don't use Netbeans, can you please show me a simple example of a GUI in Java in case of:
The GUI consist of a JFrame with only one button and a JDialog.
When we click the button, it shows the JDialog.

Thank U very much for any help..

4
Contributors
7
Replies
10
Views
7 Years
Discussion Span
Last Post by peter_budo
0
private void mnOneActionPerformed(java.awt.event.ActionEvent evt)
    {
        jDialog1.setVisible(true);
    }

shows the dialog on my netbeans(6.9), depends on what you mean by show?

Krefie

Edited by Krefie: n/a

0

For more precise: I build the JDialog from File-New File-Swing GUI Forms-JDialog Form and I name it: frm_edi
I'm using Netbeans 6.5. I've tried your code and it doesn't work.

0

Sorry for late reply. Those are all codes I wrote, nothing more. I think I have fixed the problem. I added a menu item named jMenuItem9 below the jMenu1 (previously i only had one menu, without any menu item below) and I applied relatively the same code like these in the JFrame:

private void jMenuItem9ActionPerformed(java.awt.event.ActionEvent evt)
{
   frm_entry_indent fei= new frm_entry_indent(this,true);
   fei.setVisible(true);
}

And it succeeded calling the jDialog named frm_entry_indent. In Netbeans we cannot add a menu without menu item below it because when we add code to that menu, it won't run.

0

hmmmm,

yeah, thats exactly what I did, soz I didnt notice that!

wel atleast you got it working then?

Regards Krefie

0

what is this true for.... means

frm_entry_indent fei= new frm_entry_indent(this,true);

kindly reply....

Edited by AmnGupta: n/a

0

what is this true for.... means

frm_entry_indent fei= new frm_entry_indent(this,true);

kindly reply....

He wouldn't know as it is IDE generated code. Obviously another drag&drop NetBeans developer in making that has no clue about coding

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.