adding scroll panes
hi friends i want to add a scroll pane to my frame, i have tried adding it but the scrollbars on the scroll pane remain disabled even though the content on the scroll pane is beyond visible area , and i am able to scroll down with the mouse roler but not through scrollbars. can you please help me out with some example code or something.
thx
Post a Short,Self Contained, Compilable and Executable, Example Program of your problem.
here is the sample application+++++++>
import java.awt.*;
import javax.swing.*;
public class sp extends Frame
{
JScrollPane sp1;
sp()
{setTitle("in constructor");
setLayout(null);
setLocation(50,50);
setVisible(true);
setSize(500,500);
TextArea ta=new TextArea();
ta.setLocation(0,0);
ta.setSize(130,120);
ta.setVisible(true);
ta.setText("some\n text \n in text area");
int v=ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS ;
int h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS;
sp1=new JScrollPane(ta,v,h);
// sp1.setLayout(null);
sp1.setLocation(20,100);
sp1.setSize(200,200);
sp1.setVisible(true);
add(sp1);
Color bluec=new Color(0,0,255);
sp1.setBackground(bluec);
bluec=new Color(233,233,0);
setBackground(bluec);
}
public static void main(String args[])
{
sp sp11=new sp();
}
}