java - How to make scrollable to jPanel -


i making swing application. , there height of jpanel. want make panel scrollable.: following description of requirement.

i have 4 jpanel in 1 jpanel mean:

jpanel p1=new jpanel(); jpanel p2=new jpanel(); jpanel p3=new jpanel(); jpanel p4=new jpanel(); 

i adding p2, p3, p4 inside p1 following output:

myoutput

like above showing panel has more height computer screen height. want display content of panel on computer screen scrolling.

i searched here , found following questions:

however, answers did not solve myproblem.

without seeing code, guess don't have jscrollpane provide scrollable behaviour want.

jpanel mainpanel = new jpanel(); //this base panel of ui jpanel p1=new jpanel(); jpanel p2=new jpanel(); jpanel p3=new jpanel(); jpanel p4=new jpanel(); jpanel newpanel = new jpanel(); newpanel.add(p1); newpanel.add(p2); newpanel.add(p3); newpanel.add(p4); jscrollpane pane = new jscrollpane(newpanel); mainpanel.add(pane); 

since use netbeans, add jscrollpane palette in you'll add panel contain 4 others. think add 4 panel jscrollpane.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -