> Justin schrieb:
> > I took an intro course to OOP 4 years ago, and I have been recently
[quoted text clipped - 12 lines]
> Bye
> Michael
I was under the assumption that an InternalFrame had to be inside a
Frame. I have tried putting it directly into the JFrame, and it is
hardcore screwed up. Its as if the JFrame is as small as possible to
contain a minimized internal frame even though I set the bounds of the
JFrame.
Sorry if this is a stupid question, I am hardcore newb and have been
stuck on this problem for 2 days.
Michael Rauscher - 25 Sep 2006 19:00 GMT
Justin schrieb:
>> Justin schrieb:
>>> I took an intro course to OOP 4 years ago, and I have been recently
[quoted text clipped - 20 lines]
> Sorry if this is a stupid question, I am hardcore newb and have been
> stuck on this problem for 2 days.
Then why do you want to add a JInternalFrame to a tab? Do you really
want a frame within a tab or do you only want a container within a tab
where you can add components to?
Bye
Michael
Justin - 25 Sep 2006 23:03 GMT
Id like a tab where the user can view and move around multiple windows
at the same time.
> Justin schrieb:
> >> Justin schrieb:
[quoted text clipped - 28 lines]
> Bye
> Michael
Michael Rauscher - 26 Sep 2006 12:08 GMT
Justin schrieb:
> Id like a tab where the user can view and move around multiple windows
> at the same time.
Ok, to use JInternalFrame you best add them to a JDesktopPane. The
following example shows a desktop within a tab page that contains two
internal frames: one that is resizable and closable and one that is
iconifiable.
import javax.swing.*;
public class Test {
public static final void main( String args[] ) {
JDesktopPane desktop = new JDesktopPane();
desktop.setPreferredSize( new java.awt.Dimension(600,400) );
JInternalFrame iframe = new JInternalFrame("First Frame");
iframe.setSize( 200, 100 );
iframe.setVisible( true );
iframe.setResizable( true );
iframe.setClosable( true );
desktop.add( iframe );
iframe = new JInternalFrame("Second Frame");
iframe.setSize( 200, 100 );
iframe.setLocation( 200, 200 );
iframe.setVisible( true );
iframe.setIconifiable( true );
desktop.add( iframe );
JTabbedPane tabbedPane = new JTabbedPane();
tabbedPane.addTab( "Desktop", desktop );
JFrame frame = new JFrame( "Test ");
frame.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
frame.setContentPane( tabbedPane );
frame.pack();
frame.setVisible(true);
}
}
Bye
Michael