From 74483c5041f865c02d68fdf11b61d30ca2da5d42 Mon Sep 17 00:00:00 2001 From: 23-spurtiNarkhedkar <86821974+23-spurtiNarkhedkar@users.noreply.github.com> Date: Fri, 21 Oct 2022 20:43:38 +0530 Subject: [PATCH] Swing in java swing,event listener and awt used --- swing.java | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 swing.java diff --git a/swing.java b/swing.java new file mode 100644 index 0000000..1377490 --- /dev/null +++ b/swing.java @@ -0,0 +1,31 @@ +import javax.swing.*; +import java.awt.event.*; + +public class swing implements ActionListener { + JTextField tf; + + swing() { + JFrame f = new JFrame("JAVA SWING EXAMPLE"); + JTextArea area = new JTextArea(); + area.setBounds(160, 170, 95, 20); + f.add(area); + JButton b = new JButton("Click Here"); + b.setBounds(180, 220, 95, 30); + b.addActionListener(this); + f.add(b); + tf = new JTextField(); + tf.setBounds(160, 170, 190, 30); + f.add(tf); + f.setSize(500, 500); + f.setLayout(null); + f.setVisible(true); + } + + public void actionPerformed(ActionEvent e) { + tf.setText("Account Created Successfully!"); + } + + public static void main(String[] args) { + new swing(); + } +}