je veux crée avec JsplitPan une fênetre partagé en 4 : avec une séparation verticale et l'illusion d'une séparation horizontale, avec une image dans chaque zone , mais le problème que mon code ne m'affiche que deux image dans la partie haute séparé verticalement , et la partie basse qui est séparé horizontalement de celle haute ne m'affiche qu'un image au lieu de deux :/, voilà 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
 
import java.awt.*;
import javax.swing.*;
 
class jsplitpane1
		extends 	JFrame
{
	private		JSplitPane	splitPaneV;
	private		JSplitPane	splitPaneH;
	private		JPanel		panel1;
	private		JPanel		panel2;
	private		JPanel		panel3;
	private		JPanel		panel4;
 
 
 
	public jsplitpane1()
	{
		setTitle( "Split Pane Application" );
		setBackground( Color.gray );
 
		JPanel topPanel = new JPanel();
		topPanel.setLayout( new BorderLayout() );
		getContentPane().add( topPanel );
 
		// Create the panels
		createPanel1();
		createPanel2();
		createPanel3();
		createPanel4();
 
		// Create a splitter pane
		splitPaneV = new JSplitPane( JSplitPane.VERTICAL_SPLIT );
		topPanel.add( splitPaneV, BorderLayout.CENTER );
 
		splitPaneH = new JSplitPane( JSplitPane.HORIZONTAL_SPLIT );
		splitPaneH.setLeftComponent( panel1 );
		splitPaneH.setRightComponent( panel2 );
 
 
		splitPaneV.setLeftComponent( splitPaneH );
		splitPaneV.setRightComponent( panel3 );
		splitPaneV.setRightComponent( panel4 );
 
}
 
	public void createPanel1()
	{
		panel1 = new JPanel();
		panel1.setLayout( new BorderLayout() );
 
		Icon image1 = new ImageIcon( "cracker.jpg" );
		JLabel label1 = new JLabel( image1 );
		panel1.add( label1 );
	}
 
	public void createPanel2()
	{
		panel2 = new JPanel();
		panel2.setLayout( new FlowLayout() );
 
		Icon image2 = new ImageIcon( "cracker.jpg" );
		JLabel label2 = new JLabel( image2 );
		panel2.add( label2 );
	}
 
	public void createPanel3()
	{
		panel3 = new JPanel();
		panel3.setLayout( new FlowLayout() );
		Icon image3 = new ImageIcon( "cracker.jpg" );
		JLabel label3 = new JLabel( image3 );
		panel3.add( label3 );
 
	}
 
	public void createPanel4()
	{
		panel4 = new JPanel();
		panel4.setLayout( new FlowLayout() );
 
		Icon image4 = new ImageIcon( "cracker.jpg" );
		JLabel label4 = new JLabel( image4 );
		panel4.add( label4 );
	}
	public static void main( String args[] )
	{
		// Create an instance of the test application
		jsplitpane1 mainFrame	= new jsplitpane1();
		mainFrame.pack();
		mainFrame.setVisible( true );
	}
}