JDK-4352327 : JOptionPane should handle a java.util.List objects in messages
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.3.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2000-07-12
  • Updated: 2001-11-27
  • Resolved: 2001-11-27
Related Reports
Duplicate :  
Description

Name: skT45625			Date: 07/11/2000


java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)


Currently JOptionPane handles objects of Array type that are passed in as the
message parameter to any of the showXXXDialog methods. It should handle an
instance of java.util.List in the same way. Not only does this make sense in
terms of cohesiveness with the Collections API, but it also makes complex
messages easier to code.

For example, currently you have to construct a complex message as follows:

  Object[] msg = new Object[3];
  msg[0] = "first line";
  msg[1] = new JTextArea("some text here");
  msg[2] = image;

Adding/inserting a new item to the msg array involves updating all the array
indexes and changing the array length. Messages that are dynamically built must
furst be built up with a List which is then converted to an Array before being
passed to JOptionPane. It would be nice to directly pass in the List.
(Review ID: 107092) 
======================================================================

Comments
WORK AROUND Name: skT45625 Date: 07/11/2000 Build the message using a List first, then call toArray() on the list when passing it as a parameter. ======================================================================
11-06-2004

EVALUATION There is a more general EOU (4304287) open about allowing the use of Collections in Swing. I have added a note to that EOU and I am closing this one as a dup. ###@###.### 2001-11-27
27-11-2001