Why not using javax.swing.event with swing?

S

S.T

Hi!

Getting warm with Java this week, I have learned that the usage of
Swing is highly recommended. I have seen many examples up to now, most
of them actually preferring Swing. However, I wonder why all of them
implement the old-fashioned (is it really?) AWT-only eventListener.
Why is this? Is something wrong with javax.swing.event ?

Sincerly,

S.T.
 
J

Joshua Cranmer

S.T said:
Hi!

Getting warm with Java this week, I have learned that the usage of
Swing is highly recommended. I have seen many examples up to now, most
of them actually preferring Swing. However, I wonder why all of them
implement the old-fashioned (is it really?) AWT-only eventListener.
Why is this? Is something wrong with javax.swing.event ?

Sincerly,

S.T.

Look at the classes in javax.swing.event... How many of them implement
basic functionality like MouseMove, etc.? Zero. The events in
javax.swing.event are those that are specific to Swing, like JTables or
JLists; the most commonly needed events are stored in java.awt.event.

Besides, the java.awt.event is NOT AWT-only; all Swing components are
really AWT components, so there was no sense in duplicating an entire
event hierarchy because of the addition of Swing.
 
S

S.T

Dear Joshua,

thank you very much for your precise answer. Now the usage of AWT
eventListeners with Swing makes sense to me.

Sincerly
S.T.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top