找不到Java符号

时间:2015-03-08 18:33:17

标签: java swing compiler-errors

我正在尝试编译2个文件,这是我的主要GUI文件

import javax.swing.border.BevelBorder;
import javax.swing.*;
import java.awt.*;



public class testP3 extends JFrame implements testP3FieldEdit
{
    private JTextField F_Name_text;
    private JTextField L_Name_text;
    private JTextArea textarea;


    public static void main(String[] args) {
        testP3 gui = new testP3();
        gui.setVisible(true);
     }
     public testP3()
    {
        super("testPro3");


        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setSize(650,600);
        JPanel mainP = new JPanel(new FlowLayout());
        JPanel yoloP = new JPanel();
        JPanel buttP=new JPanel(new FlowLayout());
        JPanel statusbar = new JPanel();
        JPanel statusP =new JPanel(new BorderLayout());
        statusbar.setBorder(new BevelBorder(BevelBorder.LOWERED));
        JLabel stdunt = new JLabel("Student Id:");


        JLabel F_Name_label = new JLabel("F_Name");
        F_Name_text = new JTextField(40);
        yoloP.add(F_Name_label);
        yoloP.add(F_Name_text);
        JLabel L_Name_label = new JLabel("L_Name");
        L_Name_text = new JTextField(40);
        yoloP.add(L_Name_label);
        yoloP.add(L_Name_text);


        JButton Add_button = new JButton("Add");
        buttP.add(Add_button);
        JButton Clean_button = new JButton("Clean");
        buttP.add(Clean_button);
        JButton Submit_button = new JButton("Submit");
        buttP.add(Submit_button);
            textarea = new JTextArea(20,40);
        textarea.setEditable(false);
        JScrollPane scroll = new JScrollPane(textarea);
        scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
        scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);


        yoloP.setLayout(new BoxLayout(yoloP,BoxLayout.Y_AXIS));


        mainP.add(yoloP);
        mainP.add(buttP);


        statusbar.setLayout(new BoxLayout(statusbar,BoxLayout.Y_AXIS));
        JLabel  statusLabel = new JLabel();


        statusLabel.setText("status");
        statusbar.add(statusLabel);
        statusbar.add(scroll);
        mainP.add(statusbar);
        add(mainP);
    }
    public String getDCF_Name()
    {
             return(F_Name_text.getText());
    }
    public void setDCF_Name(String F_Name)
    {
            F_Name_text.setText(F_Name);
    }
    public String getDCL_Name()
    {
             return(L_Name_text.getText());
    }
    public void setDCL_Name(String L_Name)
    {
            L_Name_text.setText(L_Name);
    }
    public void appendToStatusArea(String message)
    {
        textarea.append(message + "\n");
    }
}

哪个接口在此文件上实现

public interface testP3FieldEdit
{
        public String getDCF_Name();
        public void setDCF_Name(String F_Name);
        public String getDCL_Name();
        public void setDCL_Name(String L_Name);
        public void appendToStatusArea(String message);
}

我想知道为什么它找不到符号,并且两个文件都在同一个文件夹中

symbol: class testP3FieldEdit
public class testP3 extends JFrame implements testP3FieldEdit
                                              ^
1 error

1 个答案:

答案 0 :(得分:0)

和我一起工作。我假设您正在使用javac进行编译,在这种情况下您必须同时编译两个文件或首先编译testP3FieldEdit
移动到两个文件的目录并以这种方式编译< BR />

javac testP3.java testP3FieldEdit.java