• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 300
  • Last Modified:

Adding ScrollBars to JPanel

Hi ,

 I have JFrame, over which i have a JInternalFrame. On this JInternalFrame i am displaying an Image using JPanel, ie JPanel which contains the image is placed on JInternalFrame.

Code is like this.

class myclass extends JPanel{
...
----
// constructor
myclass()
{
-- --
--
JScrollPane scroll = new JScrollPane(this);

}

}
i have set the color of scrollpane to white(for testing the presence)

When the image is displayed the scrollpane appears as a bar next to image,
when the image is zoomed, this bar disappears and the image is zoomed, but no scrollbars appear.

can i get help for this,

regards
0
alpjose
Asked:
alpjose
1 Solution
 
objectsCommented:
You need to set the preferred size of your panel.
override getPreferredSize() method to return appropriate sizxe.
0
 
alpjoseAuthor Commented:
After setting the preferredSize it works,
thank you very much.

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now