/[classpath]/classpath/javax/swing/JOptionPane.java
ViewVC logotype

Diff of /classpath/javax/swing/JOptionPane.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.11.2.3 by gnu_andrew, Tue Sep 20 18:46:31 2005 UTC revision 1.11.2.4 by gnu_andrew, Wed Nov 2 00:43:46 2005 UTC
# Line 39  exception statement from your version. * Line 39  exception statement from your version. *
39  package javax.swing;  package javax.swing;
40    
41  import java.awt.Component;  import java.awt.Component;
 import java.awt.Dimension;  
42  import java.awt.Frame;  import java.awt.Frame;
43    
44  import javax.accessibility.Accessible;  import javax.accessibility.Accessible;
# Line 60  public class JOptionPane extends JCompon Line 59  public class JOptionPane extends JCompon
59    /**    /**
60     * DOCUMENT ME!     * DOCUMENT ME!
61     */     */
62      // FIXME: This inner class is a complete stub and needs to be implemented
63      // properly.
64    protected class AccessibleJOptionPane extends JComponent.AccessibleJComponent    protected class AccessibleJOptionPane extends JComponent.AccessibleJComponent
65    {    {
66      /** DOCUMENT ME! */      /** DOCUMENT ME! */
67      private static final long serialVersionUID = 686071432213084821L;      private static final long serialVersionUID = 686071432213084821L;
68        
69      /**      /**
70       * Creates a new AccessibleJOptionPane object.       * Creates a new AccessibleJOptionPane object.
71       */       */
72      protected AccessibleJOptionPane()      protected AccessibleJOptionPane()
73      {      {
74          // Nothing to do here.
75      }      }
76    
77      /**      /**
# Line 343  public class JOptionPane extends JCompon Line 345  public class JOptionPane extends JCompon
345      setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));      setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
346    
347      updateUI();      updateUI();
     invalidate();  
     repaint();  
348    }    }
349    
350    /**    /**
# Line 377  public class JOptionPane extends JCompon Line 377  public class JOptionPane extends JCompon
377      dialog.getContentPane().add(this);      dialog.getContentPane().add(this);
378      dialog.setModal(true);      dialog.setModal(true);
379      dialog.setResizable(false);      dialog.setResizable(false);
     dialog.invalidate();  
     dialog.repaint();  
380    
381      return dialog;      return dialog;
382    }    }
# Line 513  public class JOptionPane extends JCompon Line 511  public class JOptionPane extends JCompon
511     */     */
512    public Object getInputValue()    public Object getInputValue()
513    {    {
514        if (getValue().equals(new Integer(CANCEL_OPTION)))
515          setInputValue(null);
516      return inputValue;      return inputValue;
517    }    }
518    
# Line 974  public class JOptionPane extends JCompon Line 974  public class JOptionPane extends JCompon
974      JDialog dialog = pane.createDialog(parentComponent, null);      JDialog dialog = pane.createDialog(parentComponent, null);
975      dialog.pack();      dialog.pack();
976      dialog.show();      dialog.show();
977        
978      return (String) pane.getInputValue();      return (String) pane.getInputValue();
979    }    }
980    
# Line 1001  public class JOptionPane extends JCompon Line 1001  public class JOptionPane extends JCompon
1001      JDialog dialog = pane.createDialog(parentComponent, null);      JDialog dialog = pane.createDialog(parentComponent, null);
1002      dialog.pack();      dialog.pack();
1003      dialog.show();      dialog.show();
1004        
1005      return (String) pane.getInputValue();      return (String) pane.getInputValue();
1006    }    }
1007    
# Line 1027  public class JOptionPane extends JCompon Line 1027  public class JOptionPane extends JCompon
1027      JDialog dialog = pane.createDialog(parentComponent, title);      JDialog dialog = pane.createDialog(parentComponent, title);
1028      dialog.pack();      dialog.pack();
1029      dialog.show();      dialog.show();
1030        
1031      return (String) pane.getInputValue();      return (String) pane.getInputValue();
1032    }    }
1033    
# Line 1060  public class JOptionPane extends JCompon Line 1060  public class JOptionPane extends JCompon
1060      JDialog dialog = pane.createDialog(parentComponent, title);      JDialog dialog = pane.createDialog(parentComponent, title);
1061      dialog.pack();      dialog.pack();
1062      dialog.show();      dialog.show();
1063        
1064      return (String) pane.getInputValue();      return pane.getInputValue();
1065    }    }
1066    
1067    /**    /**
# Line 1081  public class JOptionPane extends JCompon Line 1081  public class JOptionPane extends JCompon
1081      JDialog dialog = pane.createDialog(null, null);      JDialog dialog = pane.createDialog(null, null);
1082      dialog.pack();      dialog.pack();
1083      dialog.show();      dialog.show();
1084        
1085      return (String) pane.getInputValue();      return (String) pane.getInputValue();
1086    }    }
1087    
# Line 1106  public class JOptionPane extends JCompon Line 1106  public class JOptionPane extends JCompon
1106      JDialog dialog = pane.createDialog(null, null);      JDialog dialog = pane.createDialog(null, null);
1107      dialog.pack();      dialog.pack();
1108      dialog.show();      dialog.show();
1109        
1110      return (String) pane.getInputValue();      return (String) pane.getInputValue();
1111    }    }
1112    
# Line 1128  public class JOptionPane extends JCompon Line 1128  public class JOptionPane extends JCompon
1128      JInternalFrame frame = pane.createInternalFrame(parentComponent, null);      JInternalFrame frame = pane.createInternalFrame(parentComponent, null);
1129    
1130      startModal(frame);      startModal(frame);
1131        
1132      return ((Integer) pane.getValue()).intValue();      if (pane.getValue() instanceof Integer)
1133          return ((Integer) pane.getValue()).intValue();
1134        return -1;
1135    }    }
1136    
1137    /**    /**
# Line 1154  public class JOptionPane extends JCompon Line 1156  public class JOptionPane extends JCompon
1156    
1157      startModal(frame);      startModal(frame);
1158    
1159      return ((Integer) pane.getValue()).intValue();      if (pane.getValue() instanceof Integer)
1160          return ((Integer) pane.getValue()).intValue();
1161        return -1;
1162    }    }
1163    
1164    /**    /**
# Line 1180  public class JOptionPane extends JCompon Line 1184  public class JOptionPane extends JCompon
1184    
1185      startModal(frame);      startModal(frame);
1186    
1187      return ((Integer) pane.getValue()).intValue();      if (pane.getValue() instanceof Integer)
1188          return ((Integer) pane.getValue()).intValue();
1189        return -1;
1190    }    }
1191    
1192    /**    /**
# Line 1208  public class JOptionPane extends JCompon Line 1214  public class JOptionPane extends JCompon
1214    
1215      startModal(frame);      startModal(frame);
1216    
1217      return ((Integer) pane.getValue()).intValue();      if (pane.getValue() instanceof Integer)
1218          return ((Integer) pane.getValue()).intValue();
1219        return -1;
1220    }    }
1221    
1222    /**    /**
# Line 1230  public class JOptionPane extends JCompon Line 1238  public class JOptionPane extends JCompon
1238      JInternalFrame frame = pane.createInternalFrame(parentComponent, null);      JInternalFrame frame = pane.createInternalFrame(parentComponent, null);
1239    
1240      startModal(frame);      startModal(frame);
1241        
1242      return (String) pane.getInputValue();      return (String) pane.getInputValue();
1243    }    }
1244    
# Line 1256  public class JOptionPane extends JCompon Line 1264  public class JOptionPane extends JCompon
1264      JInternalFrame frame = pane.createInternalFrame(parentComponent, title);      JInternalFrame frame = pane.createInternalFrame(parentComponent, title);
1265    
1266      startModal(frame);      startModal(frame);
1267        
1268      return (String) pane.getInputValue();      return (String) pane.getInputValue();
1269    }    }
1270    
# Line 1291  public class JOptionPane extends JCompon Line 1299  public class JOptionPane extends JCompon
1299      JInternalFrame frame = pane.createInternalFrame(parentComponent, title);      JInternalFrame frame = pane.createInternalFrame(parentComponent, title);
1300    
1301      startModal(frame);      startModal(frame);
1302        
1303      return (String) pane.getInputValue();      return pane.getInputValue();
1304    }    }
1305    
1306    /**    /**
# Line 1384  public class JOptionPane extends JCompon Line 1392  public class JOptionPane extends JCompon
1392      JInternalFrame frame = pane.createInternalFrame(parentComponent, title);      JInternalFrame frame = pane.createInternalFrame(parentComponent, title);
1393    
1394      startModal(frame);      startModal(frame);
1395    
1396      return ((Integer) pane.getValue()).intValue();      if (pane.getValue() instanceof Integer)
1397          return ((Integer) pane.getValue()).intValue();
1398        return -1;
1399    }    }
1400    
1401    /**    /**
# Line 1400  public class JOptionPane extends JCompon Line 1410  public class JOptionPane extends JCompon
1410      JOptionPane pane = new JOptionPane(message, INFORMATION_MESSAGE);      JOptionPane pane = new JOptionPane(message, INFORMATION_MESSAGE);
1411      JDialog dialog = pane.createDialog(parentComponent, null);      JDialog dialog = pane.createDialog(parentComponent, null);
1412      dialog.pack();      dialog.pack();
1413      dialog.show();      dialog.show();  
1414    }    }
1415    
1416    /**    /**
# Line 1472  public class JOptionPane extends JCompon Line 1482  public class JOptionPane extends JCompon
1482      dialog.pack();      dialog.pack();
1483      dialog.show();      dialog.show();
1484    
1485      return ((Integer) pane.getValue()).intValue();      if (pane.getValue() instanceof Integer)
1486          return ((Integer) pane.getValue()).intValue();
1487        return -1;
1488    }    }
1489    
1490    /**    /**
# Line 1532  public class JOptionPane extends JCompon Line 1544  public class JOptionPane extends JCompon
1544     * JInternalFrame's preferred size.     * JInternalFrame's preferred size.
1545     *     *
1546     * @param f The JInternalFrame to make modal.     * @param f The JInternalFrame to make modal.
    * @param pane The JOptionPane to add to the JInternalFrame.  
1547     */     */
1548    private static void startModal(JInternalFrame f)    private static void startModal(JInternalFrame f)
1549    {    {
1550      synchronized (f)      synchronized (f)
1551        {      {
1552          final JInternalFrame tmp = f;        final JInternalFrame tmp = f;
1553          tmp.toFront();        tmp.toFront();
1554    
1555          f.addInternalFrameListener(new InternalFrameAdapter()        f.addInternalFrameListener(new InternalFrameAdapter()
1556              {                                   {
1557                public void internalFrameClosed(InternalFrameEvent e)                                     public void internalFrameClosed(InternalFrameEvent e)
1558                {                                     {
1559                  synchronized (tmp)                                       synchronized (tmp)
1560                    {                                       {
1561                      tmp.removeInternalFrameListener(this);                                         tmp.removeInternalFrameListener(this);
1562                      tmp.notifyAll();                                         tmp.notifyAll();
1563                    }                                       }
1564                }                                     }
1565              });                                   });
1566          try        try
1567            {          {
1568              while (! f.isClosed())            while (! f.isClosed())
1569                f.wait();              f.wait();
1570            }          }
1571          catch (InterruptedException ignored)        catch (InterruptedException ignored)
1572            {          {
1573            }            // Ignore this Exception.
1574        }          }
1575        }
1576    }    }
1577  }  }

Legend:
Removed from v.1.11.2.3  
changed lines
  Added in v.1.11.2.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26