/[classpath]/classpath/javax/swing/plaf/basic/BasicOptionPaneUI.java
ViewVC logotype

Diff of /classpath/javax/swing/plaf/basic/BasicOptionPaneUI.java

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

revision 1.10.2.6 by gnu_andrew, Tue Sep 20 18:46:33 2005 UTC revision 1.10.2.7 by gnu_andrew, Wed Nov 2 00:43:55 2005 UTC
# Line 70  import javax.swing.JList; Line 70  import javax.swing.JList;
70  import javax.swing.JOptionPane;  import javax.swing.JOptionPane;
71  import javax.swing.JPanel;  import javax.swing.JPanel;
72  import javax.swing.JTextField;  import javax.swing.JTextField;
73    import javax.swing.LookAndFeel;
74  import javax.swing.SwingUtilities;  import javax.swing.SwingUtilities;
 import javax.swing.UIDefaults;  
75  import javax.swing.UIManager;  import javax.swing.UIManager;
76  import javax.swing.border.Border;  import javax.swing.border.Border;
77  import javax.swing.plaf.ComponentUI;  import javax.swing.plaf.ComponentUI;
# Line 141  public class BasicOptionPaneUI extends O Line 141  public class BasicOptionPaneUI extends O
141                                                                                optionPane);                                                                                optionPane);
142        if (inf != null)        if (inf != null)
143          {          {
144            try            try
145              {              {
146                inf.setClosed(true);                inf.setClosed(true);
147              }              }
148            catch (PropertyVetoException pve)            catch (PropertyVetoException pve)
149              {              {
150              }                // We do nothing if attempt has been vetoed.
151                }
152          }          }
153      }      }
154    }    }
# Line 405  public class BasicOptionPaneUI extends O Line 406  public class BasicOptionPaneUI extends O
406                 || e.getPropertyName().equals(JOptionPane.WANTS_INPUT_PROPERTY)                 || e.getPropertyName().equals(JOptionPane.WANTS_INPUT_PROPERTY)
407                 || e.getPropertyName().equals(JOptionPane.SELECTION_VALUES_PROPERTY))                 || e.getPropertyName().equals(JOptionPane.SELECTION_VALUES_PROPERTY))
408          {          {
409            optionPane.removeAll();            optionPane.remove(messageAreaContainer);
410            messageAreaContainer = createMessageArea();            messageAreaContainer = createMessageArea();
411            optionPane.add(messageAreaContainer);            optionPane.add(messageAreaContainer);
412            optionPane.add(buttonContainer);            Container newButtons = createButtonArea();
413              optionPane.remove(buttonContainer);
414              optionPane.add(newButtons);
415              buttonContainer = newButtons;
416              optionPane.add(buttonContainer);
417          }          }
418        optionPane.invalidate();        optionPane.invalidate();
419        optionPane.repaint();        optionPane.repaint();
420      }      }
421    }    }
422    
423      /**
424       * The minimum width for JOptionPanes.
425       */
426      public static final int MinimumWidth = 262;
427    
428      /**
429       * The minimum height for JOptionPanes.
430       */
431      public static final int MinimumHeight = 90;
432    
433    /** Whether the JOptionPane contains custom components. */    /** Whether the JOptionPane contains custom components. */
434    protected boolean hasCustomComponents = false;    protected boolean hasCustomComponents = false;
435    
# Line 433  public class BasicOptionPaneUI extends O Line 448  public class BasicOptionPaneUI extends O
448    /** The component that receives input when the JOptionPane needs it. */    /** The component that receives input when the JOptionPane needs it. */
449    protected JComponent inputComponent;    protected JComponent inputComponent;
450    
   /** The minimum height of the JOptionPane. */  
   public static int minimumHeight;  
   
   /** The minimum width of the JOptionPane. */  
   public static int minimumWidth;  
   
451    /** The minimum dimensions of the JOptionPane. */    /** The minimum dimensions of the JOptionPane. */
452    protected Dimension minimumSize;    protected Dimension minimumSize;
453    
# Line 518  public class BasicOptionPaneUI extends O Line 527  public class BasicOptionPaneUI extends O
527       */       */
528      public void paintIcon(Component c, Graphics g, int x, int y)      public void paintIcon(Component c, Graphics g, int x, int y)
529      {      {
530          // Nothing to do here.
531      }      }
532    }    }
533    
# Line 637  public class BasicOptionPaneUI extends O Line 647  public class BasicOptionPaneUI extends O
647     */     */
648    public BasicOptionPaneUI()    public BasicOptionPaneUI()
649    {    {
650        // Nothing to do here.
651    }    }
652    
653    /**    /**
# Line 941  public class BasicOptionPaneUI extends O Line 952  public class BasicOptionPaneUI extends O
952        {        {
953        case JOptionPane.YES_NO_OPTION:        case JOptionPane.YES_NO_OPTION:
954          return new Object[] { YES_STRING, NO_STRING };          return new Object[] { YES_STRING, NO_STRING };
       case JOptionPane.DEFAULT_OPTION:  
955        case JOptionPane.YES_NO_CANCEL_OPTION:        case JOptionPane.YES_NO_CANCEL_OPTION:
956          return new Object[] { YES_STRING, NO_STRING, CANCEL_STRING };          return new Object[] { YES_STRING, NO_STRING, CANCEL_STRING };
957        case JOptionPane.OK_CANCEL_OPTION:        case JOptionPane.OK_CANCEL_OPTION:
958          return new Object[] { OK_STRING, CANCEL_STRING };          return new Object[] { OK_STRING, CANCEL_STRING };
959          case JOptionPane.DEFAULT_OPTION:
960            return (optionPane.getWantsInput() ) ?
961                   new Object[] { OK_STRING, CANCEL_STRING } :
962                   ( optionPane.getMessageType() == JOptionPane.QUESTION_MESSAGE ) ?
963                   new Object[] { YES_STRING, NO_STRING, CANCEL_STRING } :
964                   // ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE, PLAIN_MESSAGE
965                   new Object[] { OK_STRING };
966        }        }
967      return null;      return null;
968    }    }
# Line 1142  public class BasicOptionPaneUI extends O Line 1159  public class BasicOptionPaneUI extends O
1159     */     */
1160    protected void installDefaults()    protected void installDefaults()
1161    {    {
1162      UIDefaults defaults = UIManager.getLookAndFeelDefaults();      LookAndFeel.installColorsAndFont(optionPane, "OptionPane.background",
1163                                         "OptionPane.foreground",
1164      optionPane.setFont(defaults.getFont("OptionPane.font"));                                       "OptionPane.font");
1165      optionPane.setBackground(defaults.getColor("OptionPane.background"));      LookAndFeel.installBorder(optionPane, "OptionPane.border");
     optionPane.setForeground(defaults.getColor("OptionPane.foreground"));  
     optionPane.setBorder(defaults.getBorder("OptionPane.border"));  
1166      optionPane.setOpaque(true);      optionPane.setOpaque(true);
1167    
1168      messageBorder = defaults.getBorder("OptionPane.messageAreaBorder");      messageBorder = UIManager.getBorder("OptionPane.messageAreaBorder");
1169      messageForeground = defaults.getColor("OptionPane.messageForeground");      messageForeground = UIManager.getColor("OptionPane.messageForeground");
1170      buttonBorder = defaults.getBorder("OptionPane.buttonAreaBorder");      buttonBorder = UIManager.getBorder("OptionPane.buttonAreaBorder");
1171    
1172      minimumSize = defaults.getDimension("OptionPane.minimumSize");      minimumSize = UIManager.getDimension("OptionPane.minimumSize");
     minimumWidth = minimumSize.width;  
     minimumHeight = minimumSize.height;  
1173    
1174      // FIXME: Image icons don't seem to work properly right now.      // FIXME: Image icons don't seem to work properly right now.
1175      // Once they do, replace the synthetic icons with these ones.      // Once they do, replace the synthetic icons with these ones.

Legend:
Removed from v.1.10.2.6  
changed lines
  Added in v.1.10.2.7

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