Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

HELP: java.awt.list vs java.util.list

115 views
Skip to first unread message

unclet

unread,
Aug 5, 1999, 3:00:00 AM8/5/99
to
I wrote Applet code (based on examples in a java beginner's book) that
defines a LIST box as follows:

set1List = new List();
set1List.setBackground(Color.white);

After coding the rest of the Applet example, the following two
lines are required at the top of the Applet code:

import java.awt.*;
import java.util.*;

When I compiler the Applet, the following error is produced:

SetApplet.java:31: Ambiguous class: java.awt.List and java.util.List
set1List = new List();
^
It seems the compiler does not know whether to use the
java.awt.List or java.util.List definition.

How can I tell the code that the List box should come from
java.awt.List???

UncleT


Christian Kaufhold

unread,
Aug 6, 1999, 3:00:00 AM8/6/99
to
unclet <a...@aaa.com> wrote:

[...]


> It seems the compiler does not know whether to use the
> java.awt.List or java.util.List definition.

> How can I tell the code that the List box should come from
> java.awt.List???

Add

import java.awt.List

after the other imports.


Christian

Arthur Cinader

unread,
Aug 6, 1999, 3:00:00 AM8/6/99
to
or use the class's full name in your code:

java.awt.List myList = new java.awt.List();

Arthur

Christian Kaufhold wrote in message
<7oen4u$j6c$1...@f40-3.zfn.uni-bremen.de>...

cst...@isilk.com

unread,
Aug 23, 1999, 3:00:00 AM8/23/99
to
unclet wrote:

> I wrote Applet code (based on examples in a java beginner's book) that
> defines a LIST box as follows:
>
> set1List = new List();
> set1List.setBackground(Color.white);
>
> After coding the rest of the Applet example, the following two
> lines are required at the top of the Applet code:
>
> import java.awt.*;
> import java.util.*;
>
> When I compiler the Applet, the following error is produced:
>
> SetApplet.java:31: Ambiguous class: java.awt.List and java.util.List
> set1List = new List();
> ^

> It seems the compiler does not know whether to use the
> java.awt.List or java.util.List definition.
>
> How can I tell the code that the List box should come from
> java.awt.List???

Just name it with fully qualified name explicitly.
set1List=new java.awt.List();

--
Tony
@iSilk.com


0 new messages