Bonjour à tous,

Je suis en train de créer ma première fenêtre graphique et le résultat est plutôt pas mal à une exception près.
Je dois afficher des séquences ADN alignées. Pour cela j'utilise un JSplitPane qui me permet d'avoir à gauche mes identifiants et à droite mes séquences. Pour les séquences j'ai un JScrollPane horizontal afin qu'une séquence entière (entre 1000 et 2000 caractères) s'affiche sur une seule ligne. Tout fonctionne bien si j'ai jusqu'à 15 séquences :
Nom : 1.png
Affichages : 263
Taille : 53,8 Ko

Par contre, il suffit que j'en rajoute une de plus pour que plus rien ne fonctionne : au lieu d'afficher les 15 premières sur une ligne il fait un retour à la ligne automatique après avoir à peine dépassé la taille horizontale visible de la fenêtre.

Nom : 2.png
Affichages : 235
Taille : 100,1 Ko

Voici le code , j'espère ne pas faire trop de bêtises en postant le message c'est la toute première fois que j'appelle à l'aide sur un forum
Un grand merci à ceux qui tenteront de m'expliquer le souci.

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
 
 
public class FenetreAlignement extends JFrame {
  private JSplitPane split;
	private MyTextPane textPaneSeq =  new MyTextPane();
	private MyTextPane textPaneID =  new MyTextPane();
  private MyJScrollPane scroll;
	private JPanel panId = new JPanel();      
  private JPanel panSeq = new JPanel();
	private ArbreAlignement arbre;
 
public FenetreAlignement(ArbreAlignement arbre) {
	this("ALignement multiple de sequences",300000,300000,false,arbre);
}
 
public FenetreAlignement(String titre, int largeur, int hauteur, boolean boolExit, ArbreAlignement arbre) {      
		this.arbre = arbre;       
    this.setTitle(titre);
    this.setSize(largeur,hauteur);
    /* centrage */
    this.setLocationRelativeTo(null);
		if(boolExit == true)
    	this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);	
		else
			this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
 
		int taille;
		char c;
		HashMap<Integer,SequenceAlignement> sequencesInitiales = arbre.getSequences();
		ArrayList<String> seq = arbre.getResultatFinal();
 
		StyledDocument doc = textPaneSeq.getStyledDocument();
		StyledDocument docID = textPaneID.getStyledDocument();
 
 
		Color cA = new Color(64,128,255);
		Attribut styleA = new Attribut("Courier new",18,cA);
		Attribut styleT = new Attribut("Courier new",18,Color.PINK);
		Attribut styleG = new Attribut("Courier new",18,Color.CYAN);
		Attribut styleC = new Attribut("Courier new",18,Color.MAGENTA);
		Attribut styleDefaut = new Attribut("Courier new",18,Color.WHITE);
 
		try {
			for(String s : seq) {
				taille = s.length();
				for(int i = 0; i < taille; i++) {
					c = s.charAt(i);
					if(c == 'A') {
						doc.insertString(doc.getLength(),"A",styleA);
					}
					else if(c == 'G') {
						doc.insertString(doc.getLength(),"G",styleG);
					}
					else if(c == 'C') {
						doc.insertString(doc.getLength(),"C",styleC);
					}	
					else if(c == 'T') {
						doc.insertString(doc.getLength(),"T",styleT);
					}	
					else {
						doc.insertString(doc.getLength(),Character.toString(c),styleDefaut);
					}				
				}
				doc.insertString(doc.getLength(),"\n",styleDefaut);
			}
		}
		catch(Exception e){}
 
		try {		
			for (HashMap.Entry<Integer, SequenceAlignement> entry :sequencesInitiales.entrySet()) {
				docID.insertString(docID.getLength(),entry.getValue().getId(),styleDefaut);
				docID.insertString(docID.getLength(),"\n",styleDefaut);
			}
		} 
		catch (BadLocationException e){}	
 
		scroll = new MyJScrollPane(textPaneSeq,JScrollPane.VERTICAL_SCROLLBAR_NEVER, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, panId, panSeq);
		split.setDividerLocation(60);
		split.setRightComponent(scroll);
		split.setLeftComponent(textPaneID);
 
    this.getContentPane().add(split);
 
    this.setVisible(true);
 
	}