Bonjour à tous,

J'ai une JPopUpMenu, dedans j'y inclu une JList.
La JPopUPMenu contient un grand nombre d'information, et j'aimerais quand je défini sa taille obtenir deux scrollbars, une à droite et une en bas.
J'ai tout essayé rien y fait donc je me tourne vers vous.
(J'ai essayé un scrollpane, sans résultat, je n'ai plus que le menu qui s'affiche)

Voici mon code :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
public class systemPopupInfo extends JPopupMenu{
 
        private final Scene3D s;
	//private JMenuItem close;
 
        private JFrame fr;
        private JPanel pan;
        private JLabel title;
 
        private javax.swing.JScrollBar jScrollBar1;
        private javax.swing.JScrollPane jScrollPane1;
        private javax.swing.JList ListData;
        private JScrollPane scrollPane;
 
 
  public systemPopupInfo(JPanel p,String name,Scene3D sc){
 
		super(name);
                s=sc;
                pan = p; 
 
                //setLayout(new BorderLayout());
 
                ListData = new JList();
                jScrollBar1 = new JScrollBar();
                scrollPane = new JScrollPane();
                ListData = new JList();
 
                title = new JLabel("Info Menu");
                title.setFont(new Font("Arial",Font.BOLD,13));
 
                add(title);  
                add(new JSeparator());
                add(ListData);
 
        }
 
    //public systemPopupInfo(JFrame f,String name,Scene3D sc){
 
 
      //  }
    public void AfficherInfo(String objName, ArrayList VectX,  ArrayList VectY,int Taille, Color col){       
 
         setDefaultLightWeightPopupEnabled(false);
 
	 setBorderPainted(true);
         setDoubleBuffered(true);	
	 setRequestFocusEnabled(true);
 
         title.setForeground(new Color(255-col.getRed(),255-col.getGreen(),255-col.getBlue()));
 
          String[] data = new String[Taille+1];
 
          data[0]= "   Nom : " +objName;
 
          for (int j=1; j<Taille ;j++){ 
 
              data[j] =  ("    " + VectX.get(j).toString()  + " : "  + VectY.get(j)).toString();
         }
         ListData.setListData(data);
         ListData.setBackground(col);
         ListData.setForeground(new Color(255-col.getRed(),255-col.getGreen(),255-col.getBlue()));
         //scrollPane.getViewport().setView(jList1);
 
         ListData.setFixedCellHeight(10);
         ListData.setFixedCellWidth(50);
 
         scrollPane.setViewportView(ListData);
         //scrollPane.add(jScrollBar1);
 
         setBackground(col);
 
         }
 
    public JPanel getPanel(){
 
        return pan;
 
    }
Ces méthodes sont appelés à partir de cette fonction :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
JPanel pan = popupInfo.getPanel();
 
                popupInfo.AfficherInfo(objName, VectX, VectY, VectX.size(), backGroundColor);
 
                //if(popupInfo.getWidth()>150 || popupInfo.getHeight()>300)
                  //           popupInfo.setPopupSize(150,400);
 
                popupInfo.show(pan, frame.getWidth() -200 , 10);
Merci d'avance