i have an applet that requests some information
from the user via a dialog box:

    private Foo[] opts = {
      new Foo("eenie"),
      new Foo("meenie"),
      new Foo("minie")
    };

    private Foo foo;

    ...

    if(foo == null)
      foo = opts[0];
    final Foo newFoo =
      (Foo) JOptionPane.showInputDialog(null,
                                        "Choose a foo.",
                                        "Setting foo",
                                        JOptionPane.QUESTION_MESSAGE,
                                        null, opts, foo);

(the argument to Foo's constructor is what is
returned by Foo's toString() method.)

the dialog comes up as expected, though it
includes an extra label along the bottom, with the
words "Java Applet Window".  i realize this extra
label is there for security reasons.  the problem
is that when the user clicks on the combo box, and
the list of options drops down, the bottommost
choice disappears behind the "Java Applet Window"
label.

this problem shows up only when the list of
options contains 3 or 4 options.  if the list is
shorter than 3, it is not long enough to intersect
the "Java Applet Window" label, and if it is
longer than 4, it correctly appears in front of
the "Java Applet Window" label.

one kluge around this is to redefine

    Foo[] opts = {
      new Foo("eenie"),
      new Foo("meenie"),
      new Foo("minie"),
      new Foo(""),
      new Foo("")
    };

which adds two more "blank" options to the combo
box (one is not enough).  this makes it possible
for the user to make a bogus choice.  the code
required to deal with this contingency is a mess,
and the resulting gui becomes prone to very
confusing behavior.

is there any other way around this problem?

thanks!

kj

_______________________________________________
Swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/swing

Reply via email to