aspose file tools
The moose likes Beginning Java and the fly likes I just don't get this Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "I just don Watch "I just don New topic
Author

I just don't get this

levi sleight
Greenhorn

Joined: Sep 19, 2012
Posts: 19
so. plain and simple i dont get what is wrong. not a clue heres my code:




so the problem is that, eclipse is telling me that line 14 and 15 have errors on them.... but there isnt anything a can see
Greg Brannon
Bartender

Joined: Oct 24, 2010
Posts: 530
Eclipse is, or if you were to try to compile the code you've posted, the compiler would be, telling you more than you're telling us. Helping you understand and overcome errors is easier if you see and post the complete error.


Learning Java using Eclipse on OpenSUSE 11.2
Linux user#: 501795
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 5807
    
    5

Hi, and welcome to the Ranch!

People will be better able to help you if you TellTheDetails(←click), such as copy/pasting the exact, complete error messages.

In this case, I can take a reasonable guess. Both error messages are probably telling you exactly what's wrong--that in one case you're trying to invoke a constructor that doesn't exist, and in the other you're trying to invoke a method that doesn't exist.

jlistm extends Object, and if you look at the docs for Object, you'll see that it doesn't have a c'tor that takes a String argument.

Similarly, you have not defined a setLayout() method on your jlistm class, and it's not inheriting any such method from its superclass (Object), so there is no such method on that class.

Does that give you a hint as to what you might have done wrong? (And note that I didn't tell you anything that wasn't in the error messages.)
levi sleight
Greenhorn

Joined: Sep 19, 2012
Posts: 19
... wow, you said almost the exact thing the error message said. nice,
i was pretty dumb, didnt look close enough at my code. i forgot to extend the classs that
had the method i was using,i think. still gotta go back and relearn a lot of this stuff.
still dont quite get what a constructor does
Jesper de Jong
Java Cowboy
Bartender

Joined: Aug 16, 2005
Posts: 12907
    
    3

levi sleight wrote:still dont quite get what a constructor does

A constructor is a special block of code that gets executed when a new instance of the class is created. You normally use it to initialize the member variables of the object. See Providing Constructors for Your Classes in Oracle's Java Tutorials for more details.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: I just don't get this
 
Similar Threads
How to add JScrollPane in a JList ?
Resultset
JList deleting multiple items
problem selecting JList item
Using JCheckBox as CellRenderer in JList