I'm working on a project, there are JInternalFrames in the mainframe. Now, we need to let them to be JFrame. I'm considering using a JFrame to hold on JInternalFrame. The problem is that the titlebar of Internalframe is there, and user can drag it around.
Is there any way to make the Internal frame work like a pane in the JFrame? After searching on the Internet, I found somebody removes the titlepane.
Do you have any good idea on this?
Thanks you!
update: Maybe I was on the wrong track. The real problem is the JInternal frame can not get out of the main Frame, or any way to make it look like it's out side of the frame?
Im not sure by what you mean by pane, but I guess like a
JPanel
? Of course you can but why, would be my question, unless you want some sort of quick floating panel, but than you say you dont want it draggable? So Im bit unsure of your motives and makes me weary to answer....Well Here is code to remove the titlepane (found it here):
And I found this to make
JInternalFrame
unmovable by removing theMouseListener
s which make it movable, but it is important to note its not necessary to remove theMouseListener
s as the method used to make it undraggable will remove theNorthPane
which theMouseListener
is added too thus its unnecessary for us to remove it ourselves.:And as per your title:
Simply call
setSize(int width,int height)
onJInternalFrame
with parameters of theJDesktopPane
swidth
andheight
(JDesktopPane
will be sized via overridinggetPreferredSize()
).Which will give us this:
Given your requirements, I suggest you just use a simple
JPanel
inside yourJFrame
content pane.