Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Add JPanel to JFrame ( Error ) Help please

$
0
0
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package team.rakkstar.application.form;

import javax.swing.JFrame; 
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

/**
 *
 * @author RAZER08
 */


public class TeamRakkStarApplicationForm extends JFrame 
{
    public static void main (String[]args)
    {
        JPanel jp = new JPanel();
        JLabel jl = new JLabel();
        JTextField jt = new JTextField(30);
        
        JFrame a = new JFrame ("Team rakkStar Application Form");
        
        a.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        a.setSize(800,600);
        a.setVisible(true);
        
        jp.add(jt);
        [color="#FF0000"]add(jp);[/color]
        
        
        
    }
}



The error is in red text.

The error says.
non-static method add(Component) cannot be referenced from static context

I'm using NetBeans IDE 7.2.1
Thanks

Viewing all articles
Browse latest Browse all 51036

Trending Articles