views:

49

answers:

3

I have this structure:

<JFrame>
         <JPanel backgroundcolor = "pink">
            <JScrollPane>
                <JTable>!!!Data here !!!</JTable>
            </JScrollPane>
         </JPanel>
</JFrame>

How do i stretch the ScrollPane it to cover the full window without using setSize? This is how it looks like now: alt text

Thanks!

A: 

Use setPreferredScrollableViewportSize() and a suitable layout.

Edit: You'll also need setFillsViewportHeight(), as discussed in Adding a Table to a Container.

trashgod
A: 

I am not familiar with the XML file format.

If it is coded, you may need to code something like this:

JScrollPane1 = new JScrollPane();
JPanel1.add(JscrollPane1);
JScrollPane1.setBounds(5,29,636,122);

JTable1 = new JTable();    
JPanel1.add(JTable1);
JScrollPane1.setBounds(5,434,553,3097);
JScrollPane1.setViewportView(JTable1);
eee
+1  A: 

Mmmph! Nobody offered a simple solution such as using BorderLayout as layout manager for my JScrollpane container!

Gabriel A. Zorrilla