• Post Reply Bookmark Topic Watch Topic
  • New Topic

Adding scroll bar  RSS feed

 
Avinash Rakkasagi
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have certain elements to be displayed in a tree structure. Not all of the elements are visible when tree is expanded. I would like to add a scroll bar in the output GUI at the right side so that when i expand the tree elements, i can see elements in a tree. I have tried various ways but none worked.
Following is the code that produces the tree structure of elements but doesn't have a scroll bar.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> I would like to add a scroll bar in the output GUI at the right side so that when i expand the tree elements,...

so why post all the dnd stuff?

a bit like going to a mechanic and saying my brakes don't work, so here's the 186 bus route to the city, what's the problem?

i.e. the dnd stuff is totally effing useless to your problem.

perhaps try adding a scrollpane for the tree?

//JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jtLeft, jtRight);
JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(jtLeft), jtRight);
 
Avinash Rakkasagi
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael Dunn wrote:>

//JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jtLeft, jtRight);
JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(jtLeft), jtRight);


The tree contents and scroll bar pane are not being displayed by making the modifications as suggested by you.
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you add the scroll pane to the GUI?
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> The tree contents and scroll bar pane are not being displayed by making the modifications as suggested by you.

then the code you're using is different to the code you posted.

just tested your posted code again, the left tree (didn't worry about the right, nothing there prior to modification),
left tree displays fine, and scrollbar shows when the tree is expanded
 
Avinash Rakkasagi
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael Dunn wrote:>
just tested your posted code again, the left tree (didn't worry about the right, nothing there prior to modification),
left tree displays fine, and scrollbar shows when the tree is expanded


Thanks Michael, the issue is resolved.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!