Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6350025

API documentation for JOptionPane using deprecated methods.

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b09
    • CPU:
      x86
    • OS:
      windows_xp

      Description

      A DESCRIPTION OF THE PROBLEM :
      A small example is provide for JOptionPane where a snippet follows:

           JOptionPane pane = new JOptionPane(arguments);
           pane.set.Xxxx(...); // Configure
           JDialog dialog = pane.createDialog(parentComponent, title);
           dialog.show();



      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The method show() in the above example is deprecated. The recommended method to call would be setVisible(true). The code snippet would then appear as:

           JOptionPane pane = new JOptionPane(arguments);
           pane.set.Xxxx(...); // Configure
           JDialog dialog = pane.createDialog(parentComponent, title);
           dialog.setVisible(true);

      ACTUAL -
      The greater body of text follows:

      Direct Use:
        To create and use an JOptionPane directly, the standard pattern is roughly as follows:
           JOptionPane pane = new JOptionPane(arguments);
           pane.set.Xxxx(...); // Configure
           JDialog dialog = pane.createDialog(parentComponent, title);
           dialog.show();
           Object selectedValue = pane.getValue();
           if(selectedValue == null)
             return CLOSED_OPTION;
           //If there is not an array of option buttons:
           if(options == null) {
             if(selectedValue instanceof Integer)
                return ((Integer)selectedValue).intValue();
             return CLOSED_OPTION;
           }
           //If there is an array of option buttons:
           for(int counter = 0, maxCounter = options.length;
              counter < maxCounter; counter++) {
              if(options[counter].equals(selectedValue))
              return counter;
           }
           return CLOSED_OPTION;


      URL OF FAULTY DOCUMENTATION :
      http://java.sun.com/j2se/1.5.0/docs/api/

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              psadhukhan Prasanta Sadhukhan
              Reporter:
              rmandalasunw Ranjith Mandala (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: