- import java.awt.*;
- import java.awt.event.*;
- class AEvent extends Frame implements ActionListener{
- TextField tf;
- AEvent(){
- //create components
- tf=new TextField();
- tf.setBounds(60,50,170,20);
- Button b=new Button("click me");
- b.setBounds(100,120,80,30);
- //register listener
- b.addActionListener(this);//passing current instance
- //add components and set size, layout and visibility
- add(b);add(tf);
- setSize(300,300);
- setLayout(null);
- setVisible(true);
- }
- public void actionPerformed(ActionEvent e){
- tf.setText("Welcome");
- }
- public static void main(String args[]){
- new AEvent();
- }
- }
Friday, 23 March 2018
AWT Events
Subscribe to:
Post Comments (Atom)
Swing Menu
Hi All, Use this code. ------------------------------------------------------- package placement; import java.awt.*; import java.io.*...
-
Hi All, See the JTable code import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.Sw...
-
import java.awt.*; import java.awt.event.*; class AEvent extends Frame implements ActionListener{ TextField tf; AEvent(...
-
Hi All, As the title given, Java is so simple, because tons of materials are available in this domain. In the coming sessions we will go...
No comments:
Post a Comment