JScrollPane et Flowlayout

Berty2000 Messages postés 14 Date d'inscription jeudi 17 octobre 2002 Statut Membre Dernière intervention 15 novembre 2006 - 15 avril 2006 à 10:42
Aethan Messages postés 50 Date d'inscription jeudi 27 avril 2006 Statut Membre Dernière intervention 4 mai 2006 - 27 avril 2006 à 15:20
Bonjour

J'ai un JScrollPane qui contient un JPanel.

Le JPanel est en flowLayout, et contient des composants.

Mon Pb est qd je redimensionne ma fenetre, et donc que la disposition des composants dans
le JPanel change, le JscrollPane ne s'adpate pas a la nouvelle disposition du JPanel.





Comment Faire.


en gros comment avoir un Flowlayout dans un JScrollPane





merci

5 réponses

bloofi Messages postés 388 Date d'inscription mercredi 1 octobre 2003 Statut Membre Dernière intervention 3 mai 2006 2
15 avril 2006 à 11:48
coucou, fait voir le bout de code qui correspond a ta construction du scroll.
0
Berty2000 Messages postés 14 Date d'inscription jeudi 17 octobre 2002 Statut Membre Dernière intervention 15 novembre 2006
15 avril 2006 à 12:18
//scroll
JScrollPane js=new JScrollPane();

//FlowLayout pour jpanel
FlowLayout fl=new Flowlayout();
fl.setAlignment(FlowLayout.LEFT);

//Jpanel
JPanel jp=new JPanel();
jp.setLayout(fl);
jp.setAlignmentX(FlowLayout.LEFT);
jp.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);

//association du jp au scroll
js.setViewportView(jp)
0
bloofi Messages postés 388 Date d'inscription mercredi 1 octobre 2003 Statut Membre Dernière intervention 3 mai 2006 2
15 avril 2006 à 13:44
le probleme ne vient peut etre pas de la, mais personellement je
construit toujours le scrollpane en dernier, une fois que j'ai fait
toutes mes merdes dans mon panel :



JPanel p = new JPanel() ;

//bidouillage du panel



JScrollPane scroll = new JScrollPane(p , JScrollPane.VERTICAL_BAR_AS_NEEDED , JScrollPane.HORIZONTAL_BAR_AS_NEEDED);





aussi, je remarque que tu construit un flowLayout pour lintegrer a ton
panel, hors il me semble que quand tu creer un JPanel floawLayout est
celui par default :



JPanel()


Creates a new
JPanel
with a double buffer
and a flow layout.,

----

JPanel(boolean isDoubleBuffered)


Creates a new
JPanel
with
FlowLayout

and the specified buffering strategy.,

----

JPanel(LayoutManager layout)


Create a new buffered JPanel with the specified layout manager,

----

JPanel(LayoutManager layout,
boolean isDoubleBuffered)


Creates a new JPanel with the specified layout manager and buffering
strategy.
0
Berty2000 Messages postés 14 Date d'inscription jeudi 17 octobre 2002 Statut Membre Dernière intervention 15 novembre 2006
15 avril 2006 à 13:51
Ca change rien...

effectivement le flowlayout est le gestionnaire par defaut.

merci qd meme.
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
Aethan Messages postés 50 Date d'inscription jeudi 27 avril 2006 Statut Membre Dernière intervention 4 mai 2006
27 avril 2006 à 15:20
Je ne m'y connais pas beaucoup en JScrollPane
Mais je pense qu'il s'adapte en Fonction de la taille du panneau et pas des composants a l'interieur...

Peut etre qu'il faudrait que ton panneau ai une taille redimensionné en fonction des tes composants, tiens moi au courant
0
Rejoignez-nous