no save
Assistance
Achat
News

Forum | programmation
[JAVA] JPanel + scroll
Panther.I, le lun. 30 avr. 2007 à 12:01:45
Bonjour à tous !

j'ai un petit soucis

j'ai une classe qui etend JPanel dans laquel je place un JPanel vide et dans ce JPanel vide je remet un JPanel (avec des labels, des champs de texte ...).

le probleme, c'est que je n'arrive pas à afficher de scrollbar à ce dernier JPanel !

tous les composants s'affichent correctement (en tout cas une partie (la taille du JPanel)) mais pas de scrollbar !

Voici une partie de mon code

public class Page4 extends JPanel {

//declaration …

public Page4(String animal, double CA) {

//init ….


/*****************declaration JPanel*******************/

panneau = new JPanel();
panneau2 = new JPanel();

panneau2.setBounds(0,350,950,300);
add(panneau2);
panneau2.setLayout(new BorderLayout());

JScrollPane scroll = new JScrollPane(panneau);
panneau2.add(scroll, BorderLayout.CENTER);

panneau.setLayout(null);

int i=0;
int x=10;
int y=10;

while (rs.next())
{
String CUG_prod = rs.getString(1);
String design_prod = rs.getString(2);

tab_CUG[i] = new JLabel("" + CUG_prod);
tab_LIB[i] = new JLabel("" + design_prod);


tab_CUG[i].setBounds(x,y,L_LAB_CUG,H_LAB_CUG);
panneau.add(tab_CUG[i]);
x += 100;

tab_LIB[i].setBounds(x,y,L_LAB_LIB,H_LAB_LIB);
panneau.add(tab_LIB[i]);
x += 320;

i += 1;
y += 50;
x = 10;

}



Quelqu'un pourrait-il m'aider à trouver une solution ou une autre facon de faire !

Merci d'avance Configuration: Windows XP
Internet Explorer 6.0


kij_82
avr. 07
Suivant
REPONSES
kij_82
avr. 07
Panther.I
avr. 07
Bj0
avr. 07
HackTrack
mai 07
Panther.I
mai 07
Panther.I
mai 07
Panther.I
mai 07
Version Web
Réalisé par RedShift
no save