• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JInternalFrame doesn't show anymore after closing

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
'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

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

 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Guru Charan Anand
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic