Where is the JFrame constructor?

P

Passero

JFrame has a constructor with a String parameter right? Not on my pc... I'm
using the JDK SE 1.4.2 and i always get the error: the constructor
JFrame(string)
is undefined. (i'm using ecclipse).

public class myFrame extends JFrame
{
public myFrame()
{
super("myTitle");
}
}

that's it...
 
P

Patrick Meuser

I don't know what ecclipse is unless you're referring to astronomy. How is
your classpath set? Maybe try a vanilla configuration of this environment
variable first, then add your paths until you get the error. Then maybe try
a different order. I've encountered numerous problems similiar to this
related to the compiler and its usually either an unreported error in the
code or a conflict in the classpath..

Patrick
 
W

Wolf Martinus

Passero said:
JFrame has a constructor with a String parameter right? Not on my pc... I'm
using the JDK SE 1.4.2 and i always get the error: the constructor
JFrame(string)
is undefined. (i'm using ecclipse).

just a guess:

forgot the "import javax.swing.JFrame;" ?

BTW: Eclipse can auto-generate imports when you use the code completion.

Wolf
 
P

Passero

Wolf Martinus said:
just a guess:

forgot the "import javax.swing.JFrame;" ?

I tried it in different IDE's: JCreator, sun one studio, all the same error.
I'm using import javax.swing.*; so that will cover the JFrame right? The
problem is that he does know the JFrame but he doesn't know the constructor
with the parameter String. The only constructor he knows for the JFrame is
that one with no parameters, that's so strange about it.
 
T

Thomas Kellerer

Passero said:
JFrame has a constructor with a String parameter right? Not on my pc... I'm
using the JDK SE 1.4.2 and i always get the error: the constructor
JFrame(string)
is undefined. (i'm using ecclipse).

public class myFrame extends JFrame
{
public myFrame()
{
super("myTitle");
}
}

that's it...
The following compiles without any problems here with JDK 1.4.2


import javax.swing.*;

public class myFrame extends JFrame
{
public myFrame()
{
super("myTitle");
}
}

There must be someting wrong with your IDE configurations. Did you try
to compile the file "by hand" on the command line?

Thomas
 
K

Ken Ream

Passero said:
JFrame has a constructor with a String parameter right? Not on my pc... I'm
using the JDK SE 1.4.2 and i always get the error: the constructor
JFrame(string)
is undefined. (i'm using ecclipse).

public class myFrame extends JFrame
{
public myFrame()
{
super("myTitle");
}
}

that's it...


In Eclipse, try high-lighting "JFrame" and hitting F3. If you have things
set
up right that will open the source for JFrame in your editor (I think its
read only
when it does that for a core class, but don't change anything to be safe).
That
might help you see what's going on.

Another thought/suggestion - Eclipse sticks a jdk somewhere in its directory
structure.
But I found it was missing something and installed a full JDK elsewhere,
then changed
preferences in Eclipse to use that JDK. If you do that, check that your
classpath and path
env variables poit to the right places.
 
T

Tassilo Horn

Ken Ream said:
In Eclipse, try high-lighting "JFrame" and hitting F3. If you have things
set
up right that will open the source for JFrame in your editor (I think its
read only
when it does that for a core class, but don't change anything to be safe).
That
might help you see what's going on.

Hi.
When I highlight a JDK-class and hit return I get
"Source not found"
"The source attachment does not contain the source for the file
Thread.class."
"You can change the source attachment by clicking Change Addached Source
below:"

Than that button, and below that, there are the fields and methods of
that class listed, but without any comments.

What must I do to get there either the corresponding JavaDoc page or
the real source of the class (better)???

I'm using Gentoo/GNU Linux with blackdown-jdk-1.4.1 and Eclipse 2.1.

Greetings and thanks,

Tassilo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top