• Post Reply Bookmark Topic Watch Topic
  • New Topic

declare a variable  RSS feed

 
Sue Nair
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to delcare variables but not construct them at this point in my code. This is what I have done:

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class AddHorseType extends JFrame implements ActionListener
{
JPanel horsePanel;
CardLayout horseLayout;
JTextField coatColorField;
JTextField ageField;
JTextField heightField;
JTextField horseIDField;
JTextField saddleField;
JTextField heavyBreedField;

JLabel coatColorLabel;
JLabel ageLabel;
JLabel heightLabel;
JLabel idLabel;
JLabel saddleLabel;
JLabel heavyhorseLabel;

JRadioButton saddleHorseRB;
JRadioButton heavyHorseRB;
JRadioButton americanSaddleRB;
JRadioButton englishSaddleRB;
JRadioButton draftRB;
JRadioButton harnessRB;

JButton addButton;
JButton clearButton;
JButton closeButton;

However, I think I am suppose to use the =new for each of these. I can't figure it out. I have tried several different ways:

Jpanel=new JPanel horsePanel; But I don't think this is right, either? Could someone please tell me how I declare, but not construct the variabel using the =new.
Thanks
 
Nicholas Jordan
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


If you look at it long enough, it catches on.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!