This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
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


Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
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: 2385
    
    8
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
 
It's not a secret anymore!