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();
}
});
} |
Partager