JeditorPane, inserer une scroolbar
Bonjour à tous,
Voila j'ai un JeditorPane qui commence a être trop long avec le texte (j'utile du html et mon texte doit être sélectionnable), je n'arrive pas a inserer une scroolbar vertical, si quelqu'un pourrait m'aiguiller :)
Merci d'avance
Code:
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
| final JFrame warning = new JFrame("Attention !");
warning.toFront();
warning.setSize(580, 660);
JPanel attention = new JPanel();
JPanel attentionMessage = new JPanel();
JPanel attentionButtonOK = new JPanel();
attention.setLayout(new BorderLayout());
JEditorPane messageWarning = new JEditorPane();
messageWarning.setContentType("text/html");
messageWarning.setEditable(false);
attentionMessage.add(messageWarning);
messageWarning.setText(
"<HTML>MON-TEXTE-EST-TROP-LONG</HTML>"
);
attentionMessage.add(messageWarning);
JButton okWarning = new JButton("OK");
attentionButtonOK.add(okWarning);
attention.add(attentionMessage,
BorderLayout.WEST);
attention.add(attentionButtonOK,
BorderLayout.SOUTH);
warning.getContentPane().add(attention);
warning.setVisible(true);
warning.setDefaultCloseOperation(warning.DISPOSE_ON_CLOSE);
okWarning
.addActionListener(new ActionListener() {
public void actionPerformed(
ActionEvent ev) {
warning.dispose();
}
});
} |