aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Question about JInternalFrame Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Question about JInternalFrame" Watch "Question about JInternalFrame" New topic
Author

Question about JInternalFrame

Alexandre Baldo
Ranch Hand

Joined: Aug 04, 2006
Posts: 48
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.


...ops!<br>-----------------<br>
SCJD<br>
SCWCD 1.4<br>
SCJP 1.4
Alexandre Baldo
Ranch Hand

Joined: Aug 04, 2006
Posts: 48
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

Joined: Oct 27, 2005
Posts: 19784
    
  20

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Alexandre Baldo
Ranch Hand

Joined: Aug 04, 2006
Posts: 48
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

Joined: Oct 27, 2005
Posts: 19784
    
  20

It should work, but it will be modal for the entire application, not just A.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question about JInternalFrame