01: package salomeTMF_plug.requirements.ihm;
02:
03: import java.awt.BorderLayout;
04: import java.awt.Dimension;
05: import java.awt.FlowLayout;
06: import java.awt.Rectangle;
07: import java.awt.event.ActionEvent;
08: import java.awt.event.ActionListener;
09:
10: import javax.swing.JButton;
11: import javax.swing.JDialog;
12: import javax.swing.JPanel;
13:
14: import org.objectweb.salome_tmf.ihm.languages.Language;
15: import org.objectweb.salome_tmf.ihm.main.SalomeTMFContext;
16:
17: public class HistoryDescViewDialog extends JDialog implements
18: ActionListener {
19: JButton fermerButton;
20:
21: public HistoryDescViewDialog(String htmlText) {
22: super (SalomeTMFContext.getInstance().getSalomeFrame(), true);
23: setModal(true);
24: JPanel contentPan = new JPanel(new BorderLayout());
25: HistoryDescViewPanel pHistoryDescViewPanel = new HistoryDescViewPanel(
26: htmlText);
27:
28: JPanel buttonPan = new JPanel(new FlowLayout());
29:
30: fermerButton = new JButton(Language.getInstance().getText(
31: "Fermer"));
32: fermerButton.setEnabled(true); //false
33: fermerButton.addActionListener(this );
34: buttonPan.add(fermerButton);
35:
36: contentPan.add(pHistoryDescViewPanel, BorderLayout.CENTER);
37: contentPan.add(buttonPan, BorderLayout.SOUTH);
38: setContentPane(contentPan);
39: /*pack();
40: setLocationRelativeTo(SalomeTMFContext.getInstance().getSalomeFrame());
41: setVisible(true);*/
42: centerScreen();
43: }
44:
45: void centerScreen() {
46: Dimension dim = getToolkit().getScreenSize();
47: this .pack();
48: Rectangle abounds = getBounds();
49: setLocation((dim.width - abounds.width) / 2,
50: (dim.height - abounds.height) / 2);
51: this .setVisible(true);
52: requestFocus();
53: }
54:
55: public void actionPerformed(ActionEvent e) {
56: if (e.getSource().equals(fermerButton)) {
57: fermerPerformed(e);
58: }
59:
60: }
61:
62: void fermerPerformed(ActionEvent e) {
63: dispose();
64: }
65: }
|