• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JavaBean and Swing Components

 
Abdul Sattar Mari
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everyone...

i have gone through the JavaBean [a bit specification ] which says that:

1: The class which you want to be a JavaBean Must implement the Serializable interface
2: class provide no-arg constrtuctor.
3: its instance variables must be private and it should provide getters and settters..

My Question: i came across reading that Swing components are JavaBeans? in what terms? if we see above 3 points then i saw the API of JLabel it implements Serializable indirectly [its fine i got it].
JLabel contains more then one constructor other than no-args.[this makes confusion so Is it allowed in JavaBean that, that class may contain more than one constructor beside that no-args constructor?].
JLabel also contans many elements beside the getter and setter eg: updateUI()..

Thanks For answering in advance..
 
Campbell Ritchie
Sheriff
Pie
Posts: 49472
64
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All Swing components implement Serializable, and have a no‑args constructor, and have public getXXX and setXXX methods for every field. The fact that they have lots of other methods and constructors is neither here nor there.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic