Anchit Mittal
Anchit Mittal

Reputation: 3426

How to add Scroll to jDesktopPane

I am a beginner and creating a java desktop application in MDI format and so have used the JDesktopPane and Internal Frames. I am using NetBeans Drag and Drop mainly for this. Now i have a requirement to design a page that could have a property to scroll. I need to know how can i work upon this.

I have been through the following code but got no positive result. Link for the referal

Upvotes: 1

Views: 1227

Answers (2)

Nabin
Nabin

Reputation: 11776

Add all components to panel and set view port

scrollPane.setViewportView(panel);

Example:

JScrollPane scrollPane = new JScrollPane();
JPanel panel = new JPanel();
panel.add(button1);//add some other componets that are already initialized
....
scrollPane.setViewportView(panel);
add(scrollPane);

Upvotes: 1

Anchit Mittal
Anchit Mittal

Reputation: 3426

I have got a solution. it may not be a proper solution but yes if i tried to add scrollpane as a parent to Desktop Pane it worked.

Upvotes: 2

Related Questions