Tuesday, September 8, 2015

How to create a object of button class in java


JButton btnOk = new JButton("OK");

here JButton is a class, btnOk is a object of the class JButton.


new is a keyword which allocate memory to btnOk object after taking it from Constructor (JButton()).

here constructor is passing parameter as "OK" which will be displayed on the button.

No comments:

Post a Comment