[JScrollPane] panel dans un JScrollPane
salut a tous,
je ne sais pas c'est quoi mon probleme avec les JScrollPane, mais encore une fois, pas de scrollbars.
voici mon code (pret a l'execution):
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| import javax.swing.*;
import java.awt.*;
public class Box1 extends JFrame{
JPanel panel1=new JPanel(),panel2;
public Box1(){
panel2=new JPanel(new GridLayout(25,1));
add(panel1);
panel1.add(new JScrollPane(panel2));
for (int i=0;i<22;i++){
panel2.add(new JButton("boutton"));
}
this.setSize(400,440);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true);
}
public static void main(String[] aer){
new Box1();
}
} |
qq aurait une idee?
merci d'avance.