Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem in dragging Panel  RSS feed

 
Sashi kanth
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, i have added few taskpanes to a ScrollablePanel, like:

private JPanel content = new ScrollablePanel();
content.add(taskpane1, "0, "+0);
content.add(taskpane2, "0, "+2);

Now the problem iam facing is that: when i click on the edge of the scrollpane (not the scrollbar, but the edge), it is directly expanding to the right with a certain width, without allowing me to drag it to a required width.

And iam not even able to drag it back to the original position.

How can i overcome this problem ?
 
Sashi kanth
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The panel is expanded drastically, and i cant drag it back.
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My crystal ball is in the garage for repairs.
So unless you post yoursscce code which demonstrates this problem, we cant help you out.
 
Sashi kanth
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
private JPanel content;
content = new ScrollablePanel();
content.setBackground(Color.WHITE);
content.add(taskpane1, "0, "+0);
content.add(taskpane2, "0, "+2);

private JSplitPane splitPane = new JSplitPane();
splitPane.setLeftComponent(content);

Finally i added the splitpane to a container.
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
While posting code, please use code tags

Then i instantiated it: content = new ScrollablePanel();

What is ScrollablePanel ? It is certainly not a standard Java class is it?
 
Sashi kanth
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, ScrollablePanel is a custom class, that extends JPanel and implements Scrollable.
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok.
So let me understand you correctly.

You got a problem in your code and you want help.
I had requested you to post your sscce code, which demonstrates this problem.
It's obvious you did not even bother to read the link.
Instead you posted some lines of code and some thing which looks like code comments.
You also have two top secret classes, called ScrollablePanel and TableLayout which you are not ready to divulge.
..and you expect us to help you fix your problem.

Sorry, I can't help you this way. Like I said before my crystal ball is zonked out.
 
Sashi kanth
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Huh, i figured out the issue. The reason for drastic expansion of the panel to the right is due to the fact that the taskpane is showing the items under it, when we expand the tree under it. As the name of the items is a bit large, the taskpane is employing a horizantal scrollpane to show them, which is of a certain width.

So the panel is expanding to the right with the width of the horizontal scrollpane, when we click on the panel, so that there is no horizontal scrollpane visible, but the width of this scrollpane is the width to which the panel expands.

Is there any way to configure this width, or is there any alternative to not allow the taskpane to expand the horizontal scrollbar ?
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!