关于java基础的一个问题,是这样的,写了一个Button按钮,然后给这个按钮设置一个监听器,目的

2025-03-18 17:17:34
推荐回答(1个)
回答1:

Stack stack = new Stack();
button.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
stack.push(field1.getText());
field2.setText(stack.pop());
}});