package untitled1; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.

swing.event.*; import java.awt.Component; import java.io.*; public abstract class First_GUI extends Component { static JFrame window = new JFrame("New Window"); static Toolkit kit= window.getToolkit(); static Dimension size = kit.getScreenSize(); static Container content=window.getContentPane(); static FlowLayout ly =new FlowLayout(FlowLayout.CENTER); static JButton B1 = new JButton("New Button"); public static void main(String[] args) {

window.setBounds(size.width/4,size.height/4,size.width/2,size.height/2); window.setDefaultCloseOperation(window.EXIT_ON_CLOSE); content.setBackground(Color.blue); content.add(B1); window.setVisible(true); B1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { content.setBackground(Color.RED); System.out.print("Ho Bi Ja Ab"); } } ); }}

Sign up to vote on this title
UsefulNot useful