문법 오류가 아닌 것 같은데 오류네요 설명을 좀 ^^;

import java.awt.*;
import java.awt.event.*;
public class GGesangi extends Frame{
super(java call);
private Choice a;
private Button b1,b2,b3,b4;
private TextField tf;
public GGesangi(){
this.setLayout(new FlowLayout());
this.b1=new Button(+);
this.b2=new Button(-);
this.b3=new Button(*);
this.b4=new Button(/);
//
this.a=new Choice();
a.add(초급);
a.add(중급);
a.add(고급);
this.add(a,Colors);
//
this.tf=new TextField(10);
//
ActionListener al=new ActionListener(){
public void actionPerformed(ActionEvent ae){
if(ae.getSource()==b1){
b1.setEnabled(false);
tf.setBackground(Color.green);
tf.setText(ae.getActionCommand());
}
else if(ae.getSource()==b2){
b2.setEnabled(false);
tf.setBackground(Color.green);
tf.setText(ae.getActionCommand());
}
else if(ae.getSource()==b3){
b3.setEnabled(false);
tf.setBackground(Color.green);
tf.setText(ae.getActionCommand());
}
else{
b4.setEnabled(false);
tf.setBackground(Color.green);
tf.setText(ae.getActionCommand());
}
}
}; // 컴포넌 끝
//

this.b1.addActionListener(al);
this.b2.addActionListener(al);
this.b3.addActionListener(al);
this.b4.addActionListener(al);
//
//
this.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
});
//
this.add(b1);
this.add(b2);
this.add(b3);
this.add(b4);
//
this.add(tf);
}
public static void main(String[] args)
{
GGesangi ae=new GGesangi();
ae.setSize(200,200);
ae.setVisible(true);
}
}

툴을 만드는 중인데..

제작중 테스트 해보던 중 에러가 뜨는데

지금은 그부분 지우고 작업하는데...super(java call);

이부분이 애러ㅣ.. -_-;; 이상한데.. 아무리 봐도 틀리지 않은 것 같은데... 지우니까 되긴하는데..

이상하네요. 아무리 봐도 틀린게 없는데.. -_-;;그리고 버튼 누르면 TextFiled 전체의 색이 바뀌는데.

표시되는 글자만 색 바뀌는 방법좀 가르쳐주세요. ^^;;그리고 이건 제가 심심해서 ActionLister의 메모리를 만들기 전에

this.b1.addActionListener(al);먼저쓰고 그담에 메모리와 컴포넌트 만드니까 에러나네요.

뭔가 규칙이 있는건가요? ^^

댓글 2

  • 옆집언니야 2025.10.20

    ㅎㅎㅎ... 생성자에 왜 안넣었을까요..;;

  • 놀리기 2025.10.20

    super(\java call\); 이라인을 생성자에 집어 넣으이소 frame의 세가지 생성자중에 frame(string str)에 \java call\이라는 스트링객체를 전달해서 타이틀을 설정한다카는건 아시지예? 그리고 나머지 궁금점은 다 구현한다음에&nbs

프로그램 개발일반 다른 글

목록