[5153] in java-interest
Re: stupid question
daemon@ATHENA.MIT.EDU (Walter Szewelanczyk)
Tue Jan 30 11:01:58 1996
From: "Walter Szewelanczyk" <Walter@stumpy.adco.com>
To: James Waldrop <sulam@construct.net>, java-interest@java.sun.com
Date: Tue, 30 Jan 1996 08:56:29 +0000
Hi james,
" James Waldrop" at Mon, 29 Jan 1996 12:30:02 -0800 wrote,
>
> Ok, so I have a dumb question... ;)
>
> Let's say I am getting a warning like the following:
>
> Foo.java:108: Warning: Public class ImagePanel must be defined in a file called "ImagePanel.java".
> public class ImagePanel extends Panel {
> ^
> Foo.java:121: Warning: Public class RenderArea must be defined in a file called "RenderArea.java".
> public class RenderArea extends Canvas {
>
>
> I can stick these in a seperate file, sure, but I'm finding it difficult
> to do that and then import them. Also, I see a lot of other applets
> with multiple class definitions in one file, so I'm wondering what other
> people do to get around this warning.
>
> James
>
If you this is the only project that you will use that class in then
do NOT define it as public . Instead of public class Foo just do
class Foo.
If this class will be used in different projects then
keep the public declaration but save it in a file with the same name
as the class i.e Foo.java. Make sure that the file is in the same
directory or somewhere in the CLASSPATH and you should be able to use
it as if it was defined as non public in your file.
I have not had to "import" classes that I declared public and saved
in their own file(at least not if saved in the same directory). If
they are not grouped in a package I am not sure how I would import
them.
Hope this helps,
Walt
P.S. Case might be important for the file but I am not sure i.e.
RenderArea.java instead of renderarea.java. Its worth a try if the
above does not work for you.
********************************************************************************************
Walter Szewelanczyk Technical Director
Walter@adco.com NET VENTURE, Inc.
"One must stay in a very RIGID state of FLEXABILITY"
********************************************************************************************
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com