aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes i cant setText to JLabel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "i cant setText to JLabel" Watch "i cant setText to JLabel" New topic
Author

i cant setText to JLabel

Lesole Mphinyane
Ranch Hand

Joined: Oct 07, 2006
Posts: 42
somebody help out..

look at ma code..

i get the following errors...;

cars.java:54: non-static variable model cannot be referenced from a static context
model.setText(modelstr);
^
cars.java:55: non-static variable carMake cannot be referenced from a static context
carMake.setText(make);
^
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2183
    
    7
First of all learn standard Java naming conventions. Every text book or tutorial I've ever seen uses them, so don't make up your own. Class names should start with an upper case.

The variable belong to the "Car" class, not the static method. Move the DB code to the class and out of the main() method.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: i cant setText to JLabel