Browse Source

Abstracted message dialog in UIController

git-svn-id: http://svn.dmdirc.com/trunk@3059 00569f92-eb28-0410-84fd-f71c24880f
tags/0.6
Gregory Holmes 16 years ago
parent
commit
1adca712d2

+ 6
- 0
src/com/dmdirc/ui/dummy/DummyController.java View File

@@ -169,4 +169,10 @@ public final class DummyController implements UIController {
169 169
         throw new UnsupportedOperationException("Not supported yet.");
170 170
     }
171 171
     
172
+    /** {@inheritDoc} */
173
+    @Override
174
+    public void showMessageDialog(final String title, final String message) {
175
+        System.out.println(message);
176
+    }
177
+    
172 178
 }

+ 8
- 0
src/com/dmdirc/ui/interfaces/UIController.java View File

@@ -171,4 +171,12 @@ public interface UIController {
171 171
      */
172 172
     void showFeedbackNag();
173 173
     
174
+    /**
175
+     * Shows a message dialog to the user
176
+     * 
177
+     * @param title Dialog title
178
+     * @param message Message to display
179
+     */
180
+    void showMessageDialog(final String title, final String message);
181
+    
174 182
 }

+ 15
- 0
src/com/dmdirc/ui/swing/SwingController.java View File

@@ -59,6 +59,7 @@ import java.lang.reflect.InvocationTargetException;
59 59
 import java.net.URI;
60 60
 import java.util.List;
61 61
 
62
+import javax.swing.JOptionPane;
62 63
 import javax.swing.SwingUtilities;
63 64
 import javax.swing.UIManager;
64 65
 import javax.swing.UnsupportedLookAndFeelException;
@@ -332,4 +333,18 @@ public final class SwingController implements UIController {
332 333
             }
333 334
         });
334 335
     }
336
+
337
+    /** {@inheritDoc} */
338
+    @Override
339
+    public void showMessageDialog(final String title, final String message) {
340
+        SwingUtilities.invokeLater(new Runnable() {
341
+
342
+            /** {@inheritDoc} */
343
+            @Override
344
+            public void run() {
345
+                JOptionPane.showMessageDialog(null, message, title,
346
+                        JOptionPane.PLAIN_MESSAGE);
347
+            }
348
+        });
349
+    }
335 350
 }

Loading…
Cancel
Save