Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to use the defined JDialog Object?  RSS feed

 
zucheng wang
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys,

I want open a JDialog1 when the file slect button "Open" be press,JDialog1 defined as below (in netBeans 5.5):
...
private void initComponents() {
jDialog1 = new javax.swing.JDialog();//and add a textfiled to tag it
...
how to use the JDialog1 above in ***ActionPerformed(){ }
when i create a new JDialog1 object in ***ActionPerformed(){ } like:
***ActionPerformed(){
...
JFrame jf = new JFrame();
JDialog JDialog1 = new JDialog(jf,true);
JDialog1.setVisible(true);
...
}

the Dialog seems not the one i expect(there is't the textfiled ). could you help me !thanks
 
Campbell Ritchie
Sheriff
Posts: 53773
127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch. Plese use code tags around your quoted code; it makes it easier to read.
Have you copied and pasted that code? Did you notice you have written jDialog1 in one place and JDialog1 in another?
You realise you are creating a new local variable whenever you click on the button; it is a completely different object from what you created earlier.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!