Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How a JInternalFrame show on Button Click

 
sandhiya sindhi
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello..
i have made method of every JInternal Frame.
Now i want when i clicke on button than the JInternalFrame related to that button open...
for this i have done this...
1) add InternalFrame in Desktop Pane in constructor and in method i have made its obj. and its size too.. and in actionPerformed i apply show() method on JInternalFrame.
But it is not working
Kindy help me
Thankz in advance.
 
sandhiya sindhi
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kindly some body please help me.
 
Jose Botella
Ranch Hand
Posts: 2120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following code worked ok.
 
sandhiya sindhi
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank u very much mir Jose. it is working very fine.
i had mistake of missing parameters in JInternalFrame object.
Thank u very much for helping me.
 
sandhiya sindhi
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sir but actionPerformed working only once. when i closes the internalform why it is not opening again by clicking on that button again???
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because that internal frame has been "dispose"d of. When you close an internal frame the default operation is to dispose() of the internal frame. For an internal frame this is like calling setVisible( false ), and setClosed( true ). If you want to show a frame again after this you have to set the frame visible, and add it back to the desktop. So the code example would work if you added the frame to the desktop and set it visible in the actionListener, or if you called setDefaultCloseOperation( JInternalFrame.HIDE_ON_CLOSE ) on the internal frame. This would just call setVisible( false ) on the internal frame and not require you to add it to the desktop again if you wanted to reuse it.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!