Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2005

Tip: Looking for answers? Try searching our database.

Opening a new class

Thread view: 
jamesbirchall@gmail.com - 21 Nov 2005 11:12 GMT
Here is some code that is not working, at the moment i am just trying
to use a button on a gui screen to display some text on the command
line...this is in a OpenFiles.class, simply prints out "text".

submenu.addActionListener(new ActionListener()
        {
            public void actionPerformed(ActionEvent e)
                {
                    OpenFiles fo = new OpenFiles();
                    fo.process();
                }
        });

But it will not allow me to compile this class and error is:
OpenFiles cannot be applied to ()

I have tried putting argStrings in but it will say local variable
argStrings is accessed from within inner class and needs to be declared
final.

Any help would be appreciated

Arophous
Andrew Thompson - 21 Nov 2005 11:26 GMT
> Here is some code that is not working,

Sleepy is it[1]?   ;-)

> ...I have tried putting argStrings

?? What is 'argStrings', and for that matter, what is
OpenFiles?  If you are having problems with code, it
is best to post exact error messages[1], and an SSCCE[2].

[1] <http://www.physci.org/codes/javafaq.jsp#exact>
[2] <http://www.physci.org/codes/sscce.jsp>

>...in but it will say local variable
> argStrings is accessed from within inner class and needs to be declared
> final.

final String argStrings;

> Any help would be appreciated

A better group for Java beginners is..
<http://www.physci.org/codes/javafaq.jsp#cljh>

And since you may also be a usenoob, a few notes on your
web interface to usenet.
<http://www.physci.org/codes/javafaq.jsp#usenet>

HTH

Signature

Andrew Thompson
physci, javasaver, 1point1c, lensescapes - athompson.info/andrew
Currently accepting short and long term contracts - on Earth.

Roedy Green - 21 Nov 2005 11:32 GMT
>But it will not allow me to compile this class and error is:
>OpenFiles cannot be applied to ()

it is telling you there is no such thing as the OpenFiles()
constructor?

Is there a public OpenFiles class?  Is it imported?  does it have such
a contructor?

did you spell it Openfiles somewhere else?
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

John C. Bollinger - 22 Nov 2005 02:41 GMT
> submenu.addActionListener(new ActionListener()
>         {
[quoted text clipped - 7 lines]
> But it will not allow me to compile this class and error is:
> OpenFiles cannot be applied to ()

That means that the OpenFiles class' constructor requires at least one
argument.  You will need to supply the appropriate argument(s).

> I have tried putting argStrings in but it will say local variable
> argStrings is accessed from within inner class and needs to be declared
> final.

That means precisely what it says.  If the argument you pass to the
constructor is a local variable in the method containing that statement
then the variable must be declared final.  Method parameters count as
local variables in this regard (and can very well be declared final if
so desired).

Signature

John Bollinger
jobollin@indiana.edu



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.