Hi,

I experimented a bit with replacing FreeColDialog cause of the problems
with JDialog.
I used JOptionPane.showInternalConfirmDialog and for me the dialog for
quitting the game from main menu actually did work and was correctly
behaving modal (prevented clicking the main menu while open).
This is showing it might actually work, which I wanted to let you know
(you can try the attached diff).
There just turned out to be some problem with the look and feel, the
buttons are showing class name+hash number.
It would also be difficult to get rid of the ugly green border and
title bar, as these methods are all-in-one affairs and difficult to
replace, maybe the look-and-feel can be set to allow this?

As for the non-modal dialogs, I wonder why the DialogCallback is
creating threads and polling every half second? Shouldn't it be enough
to set a listener for the dialog closing?
Not sure if its worth trying to change this or better to skip that and
only work on replacing those non-modal dialogs with panels.

(everything only after the release)


Greetings,

wintertime
diff --git a/src/net/sf/freecol/client/gui/Canvas.java b/src/net/sf/freecol/client/gui/Canvas.java
index cb859a3..14e3839 100644
--- a/src/net/sf/freecol/client/gui/Canvas.java
+++ b/src/net/sf/freecol/client/gui/Canvas.java
@@ -50,6 +50,7 @@ import javax.swing.JInternalFrame;
 import javax.swing.JLayeredPane;
 import javax.swing.JMenuBar;
 import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
 import javax.swing.SwingUtilities;
 import javax.swing.UIManager;
 import javax.swing.border.EmptyBorder;
@@ -1543,10 +1544,11 @@ public final class Canvas extends JDesktopPane {
      */
     boolean showConfirmDialog(Tile tile, Object obj, ImageIcon icon,
                               String okKey, String cancelKey) {
-        FreeColConfirmDialog fcd
-            = new FreeColConfirmDialog(freeColClient, frame, true, obj, icon,
-                                       okKey, cancelKey);
-        return showFreeColDialog(fcd, tile);
+        return JOptionPane.showInternalConfirmDialog(this, obj, null, JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, icon)==0;
+//        FreeColConfirmDialog fcd
+//            = new FreeColConfirmDialog(freeColClient, frame, true, obj, icon,
+//                                       okKey, cancelKey);
+//        return showFreeColDialog(fcd, tile);
     }
 
     /**
------------------------------------------------------------------------------
_______________________________________________
Freecol-developers mailing list
Freecol-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freecol-developers

Reply via email to