related to JScroll Panel
can i add panel with null layout inside the JScroll Pane
example
JPanel jp = JPanel();
jp.setLayout(null);
jp.setBounds(new Rectangle(0,0,500,500));
JScrollPane jp = new JScrollPane(jp);
this is part of my code, it is compiling and executing but
the Scrolling of the pane is not happening when i go to the
corner of the panel.
can any one help me?
hi there,you need to write extra code for it.scroller.setVerticalScrollBarPolicy(javax.swing.JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);scroller.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);Hope it works Del M.
delm at 2007-6-29 0:58:47 >

Hmmm...
I'd change the background color of the JPanel to see how big it realy is. Maybe JScrollPane uses the getPreferredSize() of the JPanel. If it has no components in it, the getPreferredSize() would return something really small, so that the JScrollPane won't need to scroll.
Try to print out the dimensions of the JPanel after it's added to the JScrollPane.
Why do you use null layout anyway?
CUL8er,
Nick.
I need to place the button as per the mouse click?
It is a work flow editor kind of things.
I can select source, sink etc and place it in the panel
and connect.
Any way you are correct,initially panel will not contain anything later on the components will be added into the
panel.once if i start adding the component into the
panel it should scroll.
so how do i solve?