Java Change Text On Click

[Solved] Java Change Text On Click | Swift - Code Explorer | yomemimo.com
Question : java change text on click

Answered by : ayaan-rao

import javax.swing.*;
import java.awt.event.*;
public class JButtonExample
{ public static void main(String[] args) { JFrame frame = new JFrame("ActionListener Example"); JButton btn = new JButton("Click here"); btn.setBounds(70,80,100,30); //Change button text on click btn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { btn.setText("OK"); } }); frame.add(btn); frame.setSize(250,250); frame.setLayout(null); frame.setVisible(true); }
}

Source : http://www.java2s.com/Tutorials/Java/Java_Swing/0500__Java_Swing_Layout.htm | Last Update : Thu, 30 Jun 22

Question : change button text by id click java

Answered by : light-lobster-vbyj236ybn2n

<input type="button" value="Button Text" id="myButton1"></input> 

Source : https://www.permadi.com/tutorial/jsInnerHTMLDOM/index.html | Last Update : Mon, 23 Nov 20

Answers related to java change text on click

Code Explorer Popular Question For Swift