Banging my head against the window

No matter what I do, I have no control over the size of child windows. This is pretty simple, but it's ignoring me totally. Here's what I've got:

// The container stuff seems to work fine. I'll include it here in case I've done something stupid in it that's affecting the child classes.

public class MainFrame extends JFrame

{

protected JDesktopFrame m_desktop;

protected JPanel m_panel;

MainFrame()

{

m_panel = new JPanel();

m_panel.setLayout(new BorderLayout());

this.setContentPane(m_panel);

m_desktop = new JDesktopPane();

m_desktop.setDesktopManager(new DefaultDesktopManager());

m_panel.add(m_desktop);

}

public void AddChildWindow()

{

MyChild child = new MyChild();

child.setVisible(true);

m_desktop.add(child);

}

}

public class MyChild extends JInternalFrame

{

private JPanel m_panel;

private JScrollPane m_scrollPane;

private JButton m_button;

public MyChild()

{

super("Title here", true, true, true, true);

m_panel = new JPanel();

m_scrollPane = new JScrollPane();

m_button = new JButton();

this.setContentPane(m_panel);

m_panel.add(m_scrollPane);

m_scrollPane.add(m_button);

m_button.setsize(200,200);

m_button.setText("This button is very very tiny for some reason.");

}

}

What I need is the ability to add a single control to this child window (a JTable, if you must know), and be able to move the window around, and resize it, and see the control. If the control is larger than the window, I need to be able to scroll.

What am I missing? I've tried lots of setSize() methods on stuff, and things like various LayoutManagers at different points, but nothing seems to make any difference. All I see is a child window with a single, tiny button, and if I resize it, it snaps back to tiny. Moving it around doesn't make it stick, either.

Any help, hints, or examples are VERY appreciated!

Eric

[2077 byte] By [wad@acm.orga] at [2007-9-30 2:25:23]
# 1
what is the problem, that the button you are adding wont resize or the window wont resize?If the button wont resize it could be that you are using the JScrollPane.add() method which you shouldn't use anyway instead use JScrollPane.setViewportView()HM.
house_monkeya at 2007-7-16 13:35:12 > top of Java-index,Archived Forums,New To Java Technology Archive...
# 2
The button is just a speck, and while I can resize the child windows, they immediately snap back to the upper-left corner with their original size (just barely large enough to show the title-bar's buttons, and the speck of the button).
wad@acm.orga at 2007-7-16 13:35:12 > top of Java-index,Archived Forums,New To Java Technology Archive...
# 3
Hey, cool! That SetViewportView thing fixed the button problem!Now all the remains is control over the window... being able to resize it and have scrollbars appear when the contents are too large to fit...
wad@acm.orga at 2007-7-16 13:35:12 > top of Java-index,Archived Forums,New To Java Technology Archive...
# 4
the scrollpane should do it all for you you just need to set the preferred size of the button (or was it minsize i always get those mixed up)HM.
house_monkeya at 2007-7-16 13:35:12 > top of Java-index,Archived Forums,New To Java Technology Archive...
# 5
Aha! I figured it out. My stupid layout was messing things up.Thanks!
wad@acm.orga at 2007-7-16 13:35:12 > top of Java-index,Archived Forums,New To Java Technology Archive...