Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java change text on click

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);  
  }
}
Comment

PREVIOUS NEXT
Code Example
Java :: change button text onclick java 
Java :: how to read file from assets folder in android 
Java :: android sharedpreferences 
Java :: java argument main 
Java :: install java debian 8 
Java :: java example 
Java :: convert bytebuffer to string 
Java :: flutter remove last caracter from string 
Java :: jframe border 
Java :: initialize hashset with values java 9 
Java :: get day of week java 
Java :: Cannot invoke toString() on the primitive type int 
Java :: how to write deserlizer java 
Java :: java arithmetic operators 
Java :: calculator with java 
Java :: how to do infinte loop in java 
Java :: localdate java 
Java :: android dismiss keyboard 
Java :: android list index 
Java :: java printf trailing whitespace 
Java :: java quotes in string 
Java :: how to use deque as stack or queue in java? 
Java :: java empty array 
Java :: check key is pressed java 
Java :: string length in java 
Java :: string tokenizer java 
Java :: how to modify string in java 
Java :: build.plugins.plugin.version 
Java :: fill two dimensional array column by column java 
Java :: how to change double to int in java 
ADD CONTENT
Topic
Content
Source link
Name
4+2 =