I want to add components to the JPanel by specifying their x,y coordinates and height & width. I want only vertical scrolling (which is not a problem) and when adding components I want the panel to be vertically limited so that the components are added into the next row (which is not problem). I have tried doing this by setting the Layout of the panel to null. but then all the components disappear.
I really appreaciate any replies as well as sample code.
Try a layout manager of type GridLayout(n,1) n= number of lines 1 = number of columns (one column only) This way you'll get only one component per row. You can set the distance between the rows and other parameters (see the class' API). I hope this helps. :)
From what i see in your explanation, you're trying to use absolute positioning, that is use a null layout manager and position your components using absolute coordinates. You'll have to use Insets to determine the correct placement of your JComponents Check out this web site: