The Artima Developer Community
Sponsored Link

Java Answers Forum
Java scrolling problem (JScrollPane)

2 replies on 1 page. Most recent reply: Nov 19, 2003 2:26 AM by mihai

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
rochana

Posts: 3
Nickname: ra
Registered: Nov, 2003

Java scrolling problem (JScrollPane) Posted: Nov 18, 2003 9:03 PM
Reply to this message Reply
Advertisement
Hi,

This is my container placement order:

JInternalFrame>JScrollPane>JPanel

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.

Thanks


mihai

Posts: 5
Nickname: mishooax
Registered: Apr, 2003

Re: Java scrolling problem (JScrollPane) Posted: Nov 19, 2003 2:21 AM
Reply to this message Reply
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.
:)

mihai

Posts: 5
Nickname: mishooax
Registered: Apr, 2003

Re: Java scrolling problem (JScrollPane) Posted: Nov 19, 2003 2:26 AM
Reply to this message Reply
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:

http://java.sun.com/docs/books/tutorial/uiswing/layout/none.html
and the references.

Flat View: This topic has 2 replies on 1 page
Topic: Radix Sort Previous Topic   Next Topic Topic: arggggg help

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use