Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JInternalFrames  RSS feed

 
Con Lu
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using Forte to create JInternal frames
My application is as follows:-
1) I have an application that is a JFrame
2) Clicking on a menu button of the JFrame causes
a JInternalFrame1 to pop up
3) I want to be able to click on a menubutton inside JInternalFrame1 and cause another JInternalFrame2 to appear
Unfortunately I can't seem to get 3) to work.
Inside the menubutton's actionPerformed my code
checks to see if the JInternalFrame2 isClosed(). If it is then, I add it to the JDesktopPane and setVisible(). If it isn't then I just setVisible().
This is the same method I used for 2) above but it doesn't seem to work.
BTW,debugging code indicates that it JInternalFrame2 ISN'T closed upon entering the actionPerformed()method. Also upon leaving actionPerformed() isVisible() returns true, despite the fact nothing is shown!!!
Any help would be much appreciated,
Thanks
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post the code that you have for this?

I'm not sure without seeing the code, but I'll bet that somewhere references to the 2nd internal frame get mangled... so the JInternalFrame that the 1st internal frame is setting visible and all isn't the real JInternalFrame on the desktop...
 
Con Lu
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Nat,
I kind of "sorted" the problem, by redoing the example.
I won't send you the code because it was a REAL mess. The mess is due to my inexperience using IDE's (Forte in this instance) which I find frustratingly inflexible as half the code seems to be ineditable, unless you fiddle with the controls.
Anyway in solving one question, another arises! I have one JInternalFrame which then opens 3 other JInternalFrames within it(sort of like a "wizard") in sequence ie
1)open first one
2)Press next which closes first one and opens second one
3)Press next which closes second one and opens third one
4)Can also move backwards to return to previously closed screen or cancel at any point closing all
The problem I have is when closing them, - especially if they have been closed before and then reopened.
It seems to take forever, and sometimes the program "hangs".
The only way I can prevent "hanging" the program is by minimizing then maximizing the outside JInternalFrame. What is happening here? Is there a big performance hit wrt to JInternalFrames?
I am in the process of trying to modify the code ie without removing the JInternalFrames from the DesktopPane and without closing them (use setVisible(false) instead. Maybe this will be less demanding on memory?
Anyone with any ideas?
Thanks a lot
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah... that's the problem I have with every GUI editor I've seen... the code becomes unmanageable whenever you try to do anything more "complex" than lay out buttons, labels, and text components on a single form.

If you're making a wizard, I'd suggest just one JInternalFrame using CardLayout. Switch cards with "next" and "previous" buttons, and all the information needed can be accessed easily in one place.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!