Bonjour,
Dans un JTextArea j'aurai du français et de l'arabe mélangé.
J'utilise setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
1- Il y a une anomalie : le "." de la première ligne se trouve à gauche.
2- Ça ne correspond pas à ce que je veux faire, car je souhaite modifier la justification sur chaque "append", et je n'ai pas trouvé de méthode sur le JTextArea qui fasse un justify...
3- à la fin des "append" le curseur se trouve positionné sur la première ligne, je voudrais l'avoir, prêt à insérer : derrière le dernier caractère de la dernière ligne.
Voici un extrait de code :
et une image de ce que j'obtiens.
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 package Test; import javax.swing.*; import java.awt.*; public class Test { public static void main(String[] args) { // create the line wrap example PAS AFFICHE ! // JTextArea first = new JTextArea(all); // first.setLineWrap(true); JFrame f = new JFrame("Test"); Font font = new Font("Simplified Arabic", Font.BOLD, 36); JTextArea second = new JTextArea(); second.setForeground(Color.BLUE); second.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); second.setFont(font); second.setLineWrap(true); JScrollPane trois = new JScrollPane(second); trois.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); //second.append("\n"); second.append("La saison été."); second.append("\n"); second.append("\t"); second.append("فَصْلُ الصَّيْف"); second.append("\n"); second.append("TITI\n"); // f.add(first); f.add(trois); // f.setSize(400, 300); f.setExtendedState(Frame.MAXIMIZED_BOTH); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); } }
En général le texte français devrait être centré, et le texte arabe cadré à droite.
MERCI d'avance pour vos suggestions !







Répondre avec citation
Partager