Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question about JInternalFrame

 
Alexandre Baldo
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, guys!
I'm working on a little project and I having some difficulties using JInternalFrame
Let me explain what's going on:

I have a JDesktopPane and I am adding a JInternalFrame (A) to it.
Inside (A) I have a JButton that make an instance of another JInternalFrame (B) and add it to the JDesktopPane as well.

The questions are:

1) How can I make (A) accessible only when (B) is closed???

2) Why (B).setSelected(true) and (B).moveToFront() doesn't work in this case?? (B) always appears behind (A)...

Thank's!!!

Baldo.
 
Alexandre Baldo
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
2) Why (B).setSelected(true) and (B).moveToFront() doesn't work in this case?? (B) always appears behind (A)...


Sorry guys! I just figured out what's going on with question #2!
I was doing this:


BUT...... I was suposed to do desktop.add(frame); FIRST!

Now just left #1!

Thank's!

Baldo.
 
Rob Spoor
Sheriff
Pie
Posts: 20667
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When the button is clicked, besides showing B you should call "setVisible(false)" on A. That will hide it.

Add an InternalFrameListener to B; extend InternalFrameAdapter for ease. Override "internalFrameClosed", and in it call "setVisible(true)" on A. That will show it again.
 
Alexandre Baldo
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank's Rod!!

But I dont't want to make (A) invisible. I want (B) to be modal...
I'll try to instance (B) as a JDialog.
I was reading the API and I think it could work...

Thanks again!

Baldo.
 
Rob Spoor
Sheriff
Pie
Posts: 20667
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It should work, but it will be modal for the entire application, not just A.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic