Et quand on cherche un peu on réussit :
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 public class Test extends JFrame { public Test() { super("Test"); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setSize(400, 300); JPanel pane = new JPanel(new BorderLayout()); pane.add(createEditorPane(), BorderLayout.CENTER); setContentPane(pane); } private Component createEditorPane() { JEditorPane editorPane = new JEditorPane(); editorPane.setEditorKit(new HTMLEditorKit()); editorPane.setText("<html><body>A<sub>n</sub></body></html>"); return editorPane; } public static void main(String[] args) { Test test = new Test(); test.setVisible(true); } }
Partager