java入门小问题
//界面中包含三个标签,其背景颜色分别为红、黄、蓝importjava.awt.*;importjava.awt.event.*;publicclassLableRYBe...
//界面中包含三个标签,其背景颜色分别为红、黄、蓝
import java.awt.*;
import java.awt.event.*;
public class LableRYB extends Frame
{
private Lable lable1 = new Lable("Redlable");
private Lable lable2 = new Lable("Yellowlable");
private Lable lable3 = new Lable("Bluelable");
public class WindowCloser extends WindowAdapter{
public void windowClosing(WindowEvent we)
{ System.exit(0);}
}
public LableRYB()
{
super("TestLable Window");
setLayout(new FlowLayout());
add(lable1);lable1.setBackground(Color.red);
add(lable2);lable2.setBackground(Color.yellow);
add(lable3);lable3.setBackground(Color.blue);
addWindowListener(new WindowCloser());
pack();
setVisible(true);
}
public static void main(String args[])
{
LableRYB ryb=new LableRYB();
}
}
编译时错误,private Lable lable1 = new Lable("Redlable");
private Lable lable2 = new Lable("Yellowlable");
private Lable lable3 = new Lable("Bluelable");
无法找到符号,怎么办 展开
import java.awt.*;
import java.awt.event.*;
public class LableRYB extends Frame
{
private Lable lable1 = new Lable("Redlable");
private Lable lable2 = new Lable("Yellowlable");
private Lable lable3 = new Lable("Bluelable");
public class WindowCloser extends WindowAdapter{
public void windowClosing(WindowEvent we)
{ System.exit(0);}
}
public LableRYB()
{
super("TestLable Window");
setLayout(new FlowLayout());
add(lable1);lable1.setBackground(Color.red);
add(lable2);lable2.setBackground(Color.yellow);
add(lable3);lable3.setBackground(Color.blue);
addWindowListener(new WindowCloser());
pack();
setVisible(true);
}
public static void main(String args[])
{
LableRYB ryb=new LableRYB();
}
}
编译时错误,private Lable lable1 = new Lable("Redlable");
private Lable lable2 = new Lable("Yellowlable");
private Lable lable3 = new Lable("Bluelable");
无法找到符号,怎么办 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询