Java

 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me



Go Back   Tutorialized ForumsWeb Design & DevelopmentJava

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Tutorialized Forums Sponsor:
  #1  
Old October 27th, 2010, 09:58 PM
UNF_Steph UNF_Steph is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Sep 2010
Posts: 4 UNF_Steph User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 21 m 5 sec
Reputation Power: 0
Can't make static reference.

I am getting a static reference error at the line adding the Welcome Label, what do I do to fix it?

Code:
//import statements
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

//class header with extends JPanel
public class LoanComparison extends JPanel
{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	/**
	 * 
	 */
	static JPanel mainPanel, centerPanel, bottomPanel;
	static JLabel Welcome, loanAmount, years, rate, monthlypayment, totalpayment;
	static JTextField loanTextField;

	public static void main (String[]args)
	{

	//declare instance variables
	int years, balance;
	double loanAmount= 0, rate=0, monthlyrate=0, monthlypayment=0, totalpayment=0;
	
	//do following inside constructor method

		//set inherited Panel to BorderLayout
		//from here onwards, I will reference to this panel as main panel
		mainPanel.setLayout (new BorderLayout());
		JFrame frame= new JFrame("Comparing Loans");
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOS  E);
		
		//set preferred size for the main panel
		mainPanel.setLayout (new GridLayout (1,2,5,10));
		
		//create a label to display welcome message
		//add the above label to the main panel
		JLabel Welcome = new JLabel ("Welcome to Compairing Loans Application");
		add (Welcome);

Reply With Quote
Reply

Viewing: Tutorialized ForumsWeb Design & DevelopmentJava > Can't make static reference.


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap