2014-02-11 2 views
1

여기에서 코드를 호출하는 클래스를 삽입 할 수 있습니까?버튼의 작업

버튼을 클릭하면 maze.java (내가 호출하고 싶은 클래스)가 실행됩니다. ,감사!

public class Main extends Applet { 

    Button mazebutton; 
    Button hexbutton; 

    public void init() { 

    mazebutton = new Button("Create a maxe"); 
    hexbutton = new Button ("Create a hexagonal Maze"); 

    mazebutton.setBounds(20,20,100,30); 
    hexbutton.setBounds(20,70,100,40); 

    add(mazebutton); 
    add(hexbutton); 
    } 

} 

답변

0
그냥

button.addActionListener(new ActionListener(){ 
    public void actionPerformed(ActionEvent e){ 
     //here you need to call a function that you need to make 
     //on "maze.java" that returns the values of each variable 
     //or starts by launching other function in the same class 
     //(maze.java) that activates the game 
    } 
}); 
과 같은 코드를 makethe 할 필요가

관련 문제