16 package net.squiz.matrix.ui;
18 import net.squiz.matrix.matrixtree.*;
19 import net.squiz.matrix.core.*;
20 import net.squiz.matrix.plaf.MatrixLookAndFeel;
23 import java.io.IOException;
24 import net.squiz.matrix.debug.*;
26 import javax.swing.border.*;
28 import java.awt.BorderLayout;
29 import java.awt.event.*;
30 import java.awt.FontMetrics;
40 implements MatrixConstants, KeyListener {
42 private static Point prevScreenLocation = null;
45 JPanel contentPane =
new JPanel(
new BorderLayout());
46 setContentPane(contentPane);
48 Border border =
new EmptyBorder(1, 1, 1, 1);
49 contentPane.setBorder(border);
51 JPanel midPanel =
new JPanel();
54 JLabel label =
new JLabel(message);
55 label.setFont(MatrixTreeBus.getActiveTree().getFontInUse());
58 contentPane.add(getTopPanel(title), BorderLayout.NORTH);
59 contentPane.add(midPanel, BorderLayout.CENTER);
62 JPanel bottomPanel =
new JPanel();
63 JLabel okButton =
new JLabel();
64 okButton.setIcon(GUIUtilities.getAssetMapIcon(
"ok.png"));
65 closeOnClick(okButton,
"ok");
86 okButton.setOpaque(
false);
87 bottomPanel.add(okButton);
90 contentPane.add(bottomPanel, BorderLayout.SOUTH);
94 enableDrag(contentPane);
96 FontMetrics fm = getFontMetrics(label.getFont());
97 int textWidth = fm.stringWidth(label.getText());
98 setSize(textWidth + 32, 125);
103 public void keyTyped(KeyEvent evt) {
106 public void keyPressed(KeyEvent evt) {
107 if(evt.getKeyCode() == evt.VK_ENTER) {
109 }
else if(evt.getKeyCode() == evt.VK_ESCAPE) {
114 public void keyReleased(KeyEvent evt) {
117 public void dispose() {
118 prevScreenLocation = getPrevLoc();
133 ErrorDialog.dispose();
136 ErrorDialog =
new ErrorDialog(message, title);