Bonjour,

J'ai un problème pour réaliser mon interface. En fait, dans ma JFrame, j'ai un JSplitPane.

Dans le côté droit de ma JSplitPane, j'ai un JScrollPane (pouvant avoir les barres horizontale et verticale) contenant un JPanel avec comme layout un BoxLayout en Y_AXIS.

Dans ce BoxLayout, j'aimerais qu'il y ai un JscrollPane (pouvant avoir une barre horizontale) par ligne.

Ainsi, j'aurai un JscrollPane principal contenant plusieurs JScrollPane.

Cependant, je n'arrive pas à avoir les deux en même temps. J'ai soit le JScrollPane principal avec les barres (et les JScrollPanes à l'intérieur n'ont pas les barres horizontales) soit l'inverse.

Voici un code de test :
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
 
	public static void main(String[] args){
		JFrame frame = new JFrame();
		frame.setTitle("Titre de la frame");
		frame.setSize(new Dimension(500, 500));
 
		Container container = frame.getContentPane();
 
		JSplitPane sp = new JSplitPane();
		sp.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
 
		JPanel mainPanel = new JPanel();
		mainPanel.setLayout(new BoxLayout(mainPanel,BoxLayout.Y_AXIS));
		JScrollPane scrollPanePrincipal = new JScrollPane(mainPanel);
 
 
 
		JPanel chartPanel = new JPanel(new BorderLayout());
		chartPanel.add(new JLabel("kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk"));
		JPanel wrapper = new JPanel(new BorderLayout());
		wrapper.add(chartPanel, BorderLayout.CENTER);
 
 
 
		JPanel chartPanel2 = new JPanel(new BorderLayout());
		chartPanel2.add(new JLabel("2kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk"));		
		JPanel wrapper2 = new JPanel(new BorderLayout());
		wrapper2.add(chartPanel2, BorderLayout.CENTER);
 
 
		mainPanel.add(new JScrollPane(wrapper));
		mainPanel.add(new JScrollPane(wrapper2));
 
		sp.add(scrollPanePrincipal, JSplitPane.RIGHT);
		container.add(sp);
		frame.setContentPane(container);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.setVisible(true);
	}
Si quelqu'un a une idée ?