Java JButton changes the content of the button itself


Import the library import javax.swing.JFrame;

JButton jb = new JButton (fill in the initial content of the button here); When the content of the
button needs to be changed later (such as: minesweeping), the following methods can be used to change it.
①jb.setText(s);//s is a variable of string type
②jb.setText("Changed content");

Guess you like

Origin blog.csdn.net/qq_43228135/article/details/86645312