File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes JavaBean and Swing Components Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "JavaBean and Swing Components" Watch "JavaBean and Swing Components" New topic

JavaBean and Swing Components

Abdul Sattar Mari

Joined: Oct 16, 2012
Posts: 2
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

Joined: Oct 13, 2005
Posts: 46397
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.
I agree. Here's the link:
subject: JavaBean and Swing Components
It's not a secret anymore!