我在程序中找不到错误。我是新手,对您的帮助将不胜感激。我遇到了我不知道该如何解决的错误。我的完整代码如下:
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class SampleApp3 extends JFrame{
Container pane;
JLabel label1;
JLabel label2;
Jlabel label3;
Jlabel label4;
public SampleApp3(){
pane=getContentPane();
setSize(650, 540);
setTitle("FormExample");
pane.setLayout(null);
label1= new JLabel("STI College Las Pinas",SwingConstants.CENTER);
label1.setBackground(Color.yellow);
label1.setToolTipText("Pogi Ako");
label1.setForeground(Color.blue);
pane.setBackground(Color.yellow);
label1.setBounds(100,210,325,50);
pane.add(label1,"Center");
label2= new JLabel("Charles Jason Decena",SwingConstants.CENTER);
label2.setBackground(Color.yellow);
label2.setToolTipText("Si Charles ay Pogi");
label2.setForeground(Color.blue);
pane.setBackground(Color.yellow);
label2.setBounds(110,215,320,48);
pane.add(label2,"Center");
label3= new JLabel("BSIT-124",SwingConstants.CENTER);
label3.setBackground(Color.yellow);
label3.setToolTipText("Ehem si Decena ay pogi");
label3.setForeground(Color.blue);
pane.setBackground(Color.yellow);
label3.setBounds(120,220,315,46);
pane.add(label3,"Center");
label4= new JLabel("Computer Programming 2",SwingConstants.CENTER);
label4.setBackground(Color.yellow);
label4.setToolTipText("Well Pogi talaga ako");
label4.setForeground(Color.blue);
pane.setBackground(Color.yellow);
label4.setBounds(130,225,315,44);
pane.add(label4,"Center");
}
public static void main(String args[]) {
SampleApp3= new SampleApp3(); //and this one
app.setVisible(true);
}
}
该错误消息说Jlabel
3和4“不能找到符号”,并且还包含文本sampleapp3。谁能帮助我解决导致错误的原因?
Java区分大小写
Jlabel label3;
Jlabel label4;
都无效。类别为JLabel
(请注意L为大写)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句