Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
692 B
1
Indexable
package LabPgm3b;
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;

public class Pgm3b implements ActionListener
{
	public static void main(String[] args) 
	{
		JFrame frame = new JFrame("Original Frame");
		frame.setSize(300,300);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		Pgm3b obj = new Pgm3b();
		JButton button = new JButton("View Message");
		frame.add(button);
		button.addActionListener(obj);
		frame.setVisible(true);
	}
	
	public void actionPerformed(ActionEvent e)
	{
		JFrame sub_frame = new JFrame("Sub Frame");
		sub_frame.setSize(200,200);
		JLabel label = new JLabel("!!! HELLO !!!");
		sub_frame.add(label);
		sub_frame.setVisible(true);
	}
}