aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes JInternalFrame doesn't show anymore after closing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JInternalFrame doesn Watch "JInternalFrame doesn New topic
Author

JInternalFrame doesn't show anymore after closing

Guru Charan Anand
Greenhorn

Joined: Mar 29, 2011
Posts: 6
'Dear All,

I am new to this forum. I have a particular issue which has
been bothering me for hours now. I am creating a simple
Swing stand alone app which has basically a JFrame as a
top level container. It has a JSplitPane which is split vertically
and there is a JInternalFrame in each of the split containers.
I also have a Menu bar with two menus (File and View).

The View menu has two items Top and Bottom. Now the issue
is, after i close one of the JInternalFrames, i am trying to retrive
it by going to the view menu and picking the appropriate item that
would call the show() method on that internal frame through
an action Listener.

While the internal frame does show(), it doesn't show as it did
originally. It shows as a hidden frame and it does show up
when i resize the JFrame.

What am i doing wrong? Also i am seeing problems resizing frames.
Kindly help. Sorry for the lengthy post. Any help is deeply appreciated.

Thanks and Regards,

Guru

Source code

==========================



Guru (SCJP, SCWCD) trying to be a Java Guru
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19720
    
  20

Guru, welcome to the Ranch! I've added the code tags Mike was talking about; for more information click on UseCodeTags.

mike ryan wrote:I imagine an Admin will move this to a new thread anyway

Already done


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4642
    
    5

JInternalFrame is designed to be housed in a JDesktopPane. Why do you think you need JInternalFrames in a JSplitPane?

Apart from that, I don't intend to analyze your IDE-generated code. To get better help sooner, post a SSCCE (Short, Self Contained, Compilable and Executable) example that demonstrates the problem and contains no irrelevant code.

luck, db
There are no new questions, but there may be new answers.
Guru Charan Anand
Greenhorn

Joined: Mar 29, 2011
Posts: 6
Ranchers,

Thanks for a quick and prompt response. In response to
Darryl's question, I need a split pane for my app to look
like a combination of a source code editor and a console.
Hence two JInternalFrames. Darryl, you are right about
it being a IDE generated code. I used NetBeans to get this
and i used a JSplitPane because maximizing the window produces
the appropriate behavior of the JInternalFrames in terms of the
space adjustments which makes it look like a standard editor.

My question is about the behavior of the JInternalFrames when
i close them and try to retrieve them by the following


It should bring back the closed frame to the similar positioning
as it was when the application was started. But i see that it
does not. It does retrieve it, but it does not place it in its
original position. I also have tried to do this using JDesktopPane,
but it still behaves the same way, probably worse, because when
i used the JDesktopPane, when i maximize the top level JFrame,
the two internal frames do not automatically resize. I hope i am
making sense.

Thanks and Regards,

Guru
Guru Charan Anand
Greenhorn

Joined: Mar 29, 2011
Posts: 6
To restate my problem again. I slightly changed things a little around from my last
posting. I have a JFrame as a top level container. Within it i have a JDesktopPane
and within the JDesktopPane i have two JInternalFrames. I have used a
GroupLayout to layout the components. When i resize the JFrame, i see all the
internal frames resized automatically. But within the frame, i am not able to resize
either of the internal frames even though i have set them to be resizable.



So my question is, how do i make the InternalFrames resizable without having to resize the
JFrame?

Any help, suggestions will be deeply appreciated.

Thanks and Regards,

Guru
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4642
    
    5

Guru Charan Anand wrote:So my question is, how do i make the InternalFrames resizable without having to resize the JFrame?

By not changing the JDesktopPane's default LayoutManager.
Guru Charan Anand
Greenhorn

Joined: Mar 29, 2011
Posts: 6
Thanks Darryl. But if i don't use a layout manager for
the JDesktopPane, how do i layout the frames. I did
try to do away with the Layout manager for the JDesktopPane,
but it doesn't display the frames. I am doing all this manually
without using a code generator as in NetBeans.

Regards
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4642
    
    5

if i don't use a layout manager for the JDesktopPane, how do i layout the frames. I did try to do away with the Layout manager for the JDesktopPane, but it doesn't display the frames.

Read the API for JInternalFrame and follow the link to the Swing tutorial on How to Use Internal Frames where you will find working examples.
 
jQuery in Action, 2nd edition
 
subject: JInternalFrame doesn't show anymore after closing