سؤال

Well, it was fine a few seconds before, but now when I point at the "HORIZONTAL" it always says "HORIZONTAL cannot be resolved or is not a field".I have deleted the old project and created a new project, but still get this problem. Can somebody tell me what's going on? Thanks. I'm using the eclipse. Here are the codes:

import java.applet.*;
import java.awt.*;
import java.awt.event.*;

public class subClass14 extends Applet{
    public void init()
    {
        Scrollbar scrollbar=new Scrollbar(Scrollbar.HORIZONTAL,20,0,0,100);
        add(scrollbar);

        Button up=new Button("Up");
        add(up);

        Button down=new Button("down");
        add(down);

        Button left=new Button("left");
        add(left);

        Button right=new Button("right");
        add(right);

        add(new CircleCanvas(up,down,left,right));
        //add(new Scrollbar(scrollbar1,scrollbar2));
    }

}
هل كانت مفيدة؟

المحلول

You created your own class called Scrollbar. Change

Scrollbar scrollbar = new Scrollbar(Scrollbar.HORIZONTAL,20,0,0,100);

to

java.awt.Scrollbar scrollbar = new java.awt.Scrollbar(
  java.awt.Scrollbar.HORIZONTAL, 20, 0, 0, 100
);
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top