Help needed (GUI/passing objects)  
Author Message
Michael Martin





PostPosted: 2003-11-10 12:03:00 Top

java-programmer, Help needed (GUI/passing objects)
Hi, I'm a student learning java. In my latest assignment, I am to create a
Scheduler/Diary, with a GUI.

I am getting the error

Exception in thread "main" java.lang.NoSuchMethodError: BaseFrame: method
<init>
()V not found
at Dairy.main(Dairy.java:22)

From the main method in 'project.class', I create the diary object, which
creates month and day objects etc...

I create a state object, which takes in the Diary Object and points to the
selected month, day, appointment etc

I then create a gui object, which is to change the state (through methods in
the state).


This error occurs whenever I pass in the state object to the GUI
('BaseFrame').

Exception in thread "main" java.lang.NoSuchMethodError: BaseFrame: method
<init>
()V not found
at Dairy.main(Dairy.java:22)

I'm not sure whats causing this. I'm checking like 22 in the 'diary' class,
but it's a }. Not too helpful.

GUI appears when no state object is passed, can't manipulate the data with
that though....

In main:

------------

//set up the Diary

Diary dia = new Diary();

//set up the state
State diaryState = new State(dia);

//Set up the gui

BaseFrame firstFrame = new BaseFrame(diaryState);

---------------


When setting up the GUI:

---------------

State curState;

//constructor for the basic frame, takes in a state object
public BaseFrame(State sta)
{
curState = sta;

.....................}

--------------------------

Done a search online, didn't get too far. Any ideas? What does that error
mean exactly?


 
Jason Teagle





PostPosted: 2003-11-10 19:08:00 Top

java-programmer >> Help needed (GUI/passing objects) > This error occurs whenever I pass in the state object to the GUI
> ('BaseFrame').
>
> Exception in thread "main" java.lang.NoSuchMethodError: BaseFrame: method
> <init>
> ()V not found
> at Dairy.main(Dairy.java:22)
>
> I'm not sure whats causing this. I'm checking like 22 in the 'diary'
class,
> but it's a }. Not too helpful.
>
> GUI appears when no state object is passed, can't manipulate the data with
> that though....

Can you show us COMPLETE code for Dairy.java (is this a cute typo, or did
you mean Diary?) and BaseFrame.java.

The error is pointing to the end of the constructor (I assume that was what
the bunch of dots was for) because after completing the constructor, it
still couldn't find some method. The way that error message is shown with
the line break is a little odd, so perhaps if you can supply all code, we
can try compiling it here and help show what is wrong.


--

 
Mitchel





PostPosted: 2003-11-11 2:14:00 Top

java-programmer >> Help needed (GUI/passing objects)
"Jason Teagle" <email***@***.com> wrote in message
news:bonrhg$1emor1$email***@***.com...
> > This error occurs whenever I pass in the state object to the GUI
> > ('BaseFrame').
> >
> > Exception in thread "main" java.lang.NoSuchMethodError: BaseFrame:
method
> > <init>
> > ()V not found
> > at Dairy.main(Dairy.java:22)
> >
> > I'm not sure whats causing this. I'm checking like 22 in the 'diary'
> class,
> > but it's a }. Not too helpful.
> >
> > GUI appears when no state object is passed, can't manipulate the data
with
> > that though....
>
> Can you show us COMPLETE code for Dairy.java (is this a cute typo, or did
> you mean Diary?) and BaseFrame.java.

I made that typo when starting, quickly changed everything to correct
spelling. Just noticed that when I deleted dairy.java and dairy.class
everything broke more.

Odd, considering theres no reference to it in my code at all. Moving all my
.java files and recompiling made it work. Or rather, give me a different
non-boggling error :-)

There was a main method in the defunct 'Dairy' that must have been
executing.

Thought I might have been passing the object wrongly or something. Seems not
to have been the case. Did do other things horribly horribly wrong though,
so whoopdedo, off to work I go.

Can't paste code because it's an assignment, and I'm not allowed to post too
much of it to public places.

> The error is pointing to the end of the constructor (I assume that was
what
> the bunch of dots was for) because after completing the constructor, it
> still couldn't find some method. The way that error message is shown with
> the line break is a little odd, so perhaps if you can supply all code, we
> can try compiling it here and help show what is wrong.

Thanks for the help.


 
 
Tor Iver Wilhelmsen





PostPosted: 2003-11-11 2:30:00 Top

java-programmer >> Help needed (GUI/passing objects) "Michael Martin" <michael_martin@ntlworld.*removethistoreply*com> writes:

> Exception in thread "main" java.lang.NoSuchMethodError: BaseFrame: method
> <init>
> ()V not found

Means: the BaseFrame class does not have a parameterless constructor,
or extends a class that apparently no longer has one that the real
constructor can call.

(The Z means void return type, and <init> is the synthesized name of
the method used to hold the initialization code collected from the
constructor with the same argument list, initialization blocks and
values initialized in the declaration.