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