JFrame layout help

Hi!I cant find any layout that fits me...I want to set a layout on a JFrame so that every component I place on the frame will be placed in a vertical line. The components also have to be as far up as possible (not like GridLayout) and to the left.Thanks!
[282 byte] By [rejeepa] at [2007-11-27 1:51:32]
# 1
BoxLayout
sabre150a at 2007-7-12 1:19:24 > top of Java-index,Desktop,Core GUI APIs...
# 2
I thought that might be the one but I couldn't figure out what target was?BoxLayout(Container target, int axis)
rejeepa at 2007-7-12 1:19:24 > top of Java-index,Desktop,Core GUI APIs...
# 3
> I thought that might be the one but I couldn't figure> out what target was?> BoxLayout(Container target, int axis)The JPanel (which isA Container) that you are working with!
sabre150a at 2007-7-12 1:19:24 > top of Java-index,Desktop,Core GUI APIs...
# 4
> I thought that might be the one but I couldn't figure out what target was?[url http://java.sun.com/docs/books/tutorial/uiswing/layout/visual.html]How to Use Box Layout[/url]
camickra at 2007-7-12 1:19:24 > top of Java-index,Desktop,Core GUI APIs...
# 5

Hi, now I get the layout. But it gets very small. Why is this?

import java.awt.Color;

import java.awt.Dimension;

import javax.swing.BoxLayout;

import javax.swing.JPanel;

import javax.swing.JFrame;

import javax.swing.JScrollPane;

import javax.swing.JTree;

public class TestCheckboxTree extends JFrame

{

public TestCheckboxTree()

{

super("Testing Checkboxes on JTree!");

JScrollPane scrollpane = new JScrollPane();

scrollpane.setPreferredSize(new Dimension(300, 300));

scrollpane.setAlignmentX(LEFT_ALIGNMENT);

JPanel panel = new JPanel();

panel.setBackground(Color.WHITE);

panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));

JTree tree = CheckboxTree.makeCheckTree(new FolderTree("/home/"));

JTree tree2 = CheckboxTree.makeCheckTree(new FolderTree("/home/rejeep/programming"));

panel.add(tree);

panel.add(tree2);

scrollpane.getViewport().add(panel);

add(scrollpane);

setDefaultCloseOperation(EXIT_ON_CLOSE);

setSize(500, 500);

setVisible(true);

}

public static void main(String args[])

{

new TestCheckboxTree();

}

}

rejeepa at 2007-7-12 1:19:24 > top of Java-index,Desktop,Core GUI APIs...