Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java jframe actionlistener

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 jframe actionlistener 
Java :: split every character in string into array java 
Java :: jbutton set on action 
Java :: byte array to base64 string 
Java :: java print variable type 
Java :: Java tree from star 
Java :: convert string to character array 
Java :: java split string 
Java :: how to minimize jframe in java 
Java :: public String toString() { 
Java :: android how to get current activity 
Java :: AmazonS3ClientBuilder 
Java :: java arraylist loop 
Java :: java restart program 
Java :: check if number is odd java 
Java :: Why should we mention a method throws some exception/s? 
Java :: android studio breakpoint not working 
Java :: 12 hours to 24 hours java 
Java :: android list[index] 
Java :: java % 
Java :: modal css react 
Java :: how to use deque as queue in java? 
Java :: java dynamic method dispatch 
Java :: convert arraylist to array in java 
Java :: string programs in java 
Java :: integer to string java 
Java :: android remove focus from an element 
Java :: joining an array of strings in java 
Java :: converter float para string em java 
Java :: Java Create ArrayList in Java 
ADD CONTENT
Topic
Content
Source link
Name
6+2 =