[問題] 按鈕問題
新手發問
按下按鈕A 想把按鈕上的"A"字改成B 請問要如何寫呢?
知道可以用 setLabel
JButton leftbutton=new JButton("A");
leftbutton.setLabel("B");
這樣會直接改
請問要如何寫 才能按下按鈕之後才改變呢?
我的程式架構是
public class MineSweeper extends JFrame {
....
....
private class left implements ActionListener
{
public void actionPerformed (ActionEvent e)
{
........
}
}
public static void main(String[] args)
{
MineSweeper obj=new MineSweeper();
obj.setVisible(true);
}
public MineSweeper()
{
介面設定在這邊
包括按鈕
}
感謝各位!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.37.51.73
討論串 (同標題文章)
完整討論串 (本文為第 1 之 2 篇):
問題
1
1