Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

change button text onclick javca

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 :: java array check duplicates 
Java :: convert array to list java 
Java :: HttpServer example java 
Java :: java get year from date 
Java :: javafx how to change shape color 
Java :: select max value from list java 
Java :: how to iterate list of string array in java 
Java :: java separate the numbers from string 
Java :: java go troght loop object 
Java :: recycler view implementation 
Java :: java stream min 
Java :: get time android 
Java :: java observer pattern 
Java :: string to hexstring In java 
Java :: map interation in java 
Java :: string to float java 
Java :: Do not concatenate text displayed with setText. Use resource string with placeholders. 
Java :: Create a button that redirects to another activity in android studio 
Java :: android get list element by index 
Java :: does set automatically get rid of duplicates in java 
Java :: how to resize image in java swing 
Java :: remove last <br/ from string java 
Java :: java spring boot json deserialize date inaccurate 
Java :: filter arraylist java 
Java :: validate date java 
Java :: loop through an arraylist android studio 
Java :: javafx text wrapping 
Java :: android html to bitmap 
Java :: fill two dimensional array row by row java 
Java :: redondear a 2 decimales java 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =