classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] FYI: enable input components in OptionPanes


From: Roman Kennke
Subject: [cp-patches] FYI: enable input components in OptionPanes
Date: Fri, 13 May 2005 15:54:04 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021204

Hi,

I modified the BasicOptionPaneUI so that is now possible to use JOptionPanes for requesting input through JTextFields, JComboBoxes or JLists.

This closes bug #13074


2005-05-13  Roman Kennke  <address@hidden>

       * javax/swing/plaf/basic/BasicOptionPaneUI.java
       (createMessageArea): Enabled input components to be used
       in OptionPanes.


/Roman

Index: javax/swing/plaf/basic/BasicOptionPaneUI.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicOptionPaneUI.java,v
retrieving revision 1.15
diff -u -r1.15 BasicOptionPaneUI.java
--- javax/swing/plaf/basic/BasicOptionPaneUI.java       11 May 2005 11:59:39 
-0000      1.15
+++ javax/swing/plaf/basic/BasicOptionPaneUI.java       13 May 2005 13:47:23 
-0000
@@ -855,6 +855,7 @@
     addIcon(messageArea);
 
     JPanel rightSide = new JPanel();
+    rightSide.setBorder(BorderFactory.createEmptyBorder(0, 11, 17, 0));
     rightSide.setLayout(new GridBagLayout());
     GridBagConstraints con = createConstraints();
 
@@ -865,19 +866,16 @@
       {
        Object[] selection = optionPane.getSelectionValues();
 
-//     if (selection == null)
-//       inputComponent = new JTextField();
-//     else if (selection.length < 20)
-//       inputComponent = new JComboBox(selection);
-       // FIXME: Uncomment when the widgets are done.
        if (selection == null)
-         inputComponent = null;
+          inputComponent = new JTextField(15);
+       else if (selection.length < 20)
+          inputComponent = new JComboBox(selection);
        else
          inputComponent = new JList(selection);
        if (inputComponent != null)
          {
            addMessageComponents(rightSide, con, inputComponent,
-                                getMaxCharactersPerLineCount(), true);
+                                 getMaxCharactersPerLineCount(), false);
            resetSelectedValue();
            selectInitialValue(optionPane);
          }

reply via email to

[Prev in Thread] Current Thread [Next in Thread]