Why swing when I have awt?

?

_.-=

Hi!

I was just wondering why anyone would bother with javax.swing when we have
java.awt?

Can anyone throw some light onto this topic?

-NiCk
 
T

Tor Iver Wilhelmsen

_.-= said:
I was just wondering why anyone would bother with javax.swing when
we have java.awt?

Because java.awt has less than 10% of the components Swing has, and
Swing is easier to write complex applications in being MVC-driven.
 
T

TDOR

I was just wondering why anyone would bother with javax.swing when we have
java.awt?

AWT: Some of its components are built on top of native
widgets and are relatively fast and responsive. Many
however are slow and buggy. AWT components generally
don't pick up information on system font sizes etc.
Lacks the more advanced components such as treeview and
table.

SWING: Has all the advanced components, but is slow and
some would say ugly. You can try and change its appearance
using skins although this aproach is not platform
independant. Like AWT it dosen't pick up on users ui
settings.

SWT: Somewhat responsive on windows and does look like
any other app on the system, but is difficult to deploy
unless you use webstart.
 
D

Daniel Dyer

SWING: Has all the advanced components, but is slow and
some would say ugly. You can try and change its appearance
using skins although this aproach is not platform independant.

Swing doesn't use skins as such, it has pluggable look and feels, which are
a fair bit more complex than skins. They are generally platform
independent (they are just Java classes after all) though some L&Fs may be
tailored for specific platforms (such as Sun's XP look and feel).
Like AWT it dosen't pick up on users ui settings.

That will depend on your look and feel. The latest Windows look and feel
is quite good in this respect and will track the user's OS preferences. I
believe the Mac OS X look and feel does something similar, though I have
never used it.
 
G

Guest

Daniel Dyer said:
Swing doesn't use skins as such, it has pluggable look and feels, which are
a fair bit more complex than skins. They are generally platform
independent (they are just Java classes after all) though some L&Fs may be
tailored for specific platforms (such as Sun's XP look and feel).

It WAS slow and ugly. I used to think so too. But try version 1.4.2
(current version). It is a new experience!
That will depend on your look and feel. The latest Windows look and feel
is quite good in this respect and will track the user's OS preferences. I
believe the Mac OS X look and feel does something similar, though I have
never used it.

The Metal (cross-platform) and Motif Look&Feel (both avail. on all
platforms)
does not pick up user settings. I do not know exactly how the Windows pre-XP
L&F behaves, but the new Windows XP L&F picks up bitmaps and settings from
XP
itself, so there is a good chance most user settings will carry over into
Java
programs. Same goes for the new GTK (Gnome) L&F.

Head over to this site and try the new version, instead of spreading old
and now incorrect information.
http://www.java.com/en/index.jsp

Roald
 
D

Daniel Dyer

"Daniel Dyer" <[email protected]> skrev i melding

....


It WAS slow and ugly. I used to think so too. But try version 1.4.2
(current version). It is a new experience!

Hang on, I never said it was slow and ugly, you need to be careful with
your quoting, I believe you were responding to the point that I quoted, not
the point I was making.
The Metal (cross-platform) and Motif Look&Feel (both avail. on all
platforms)
does not pick up user settings. I do not know exactly how the Windows
pre-XP
L&F behaves, but the new Windows XP L&F picks up bitmaps and settings
from
XP
itself, so there is a good chance most user settings will carry over into
Java
programs. Same goes for the new GTK (Gnome) L&F.

Yes, I was not disputing that, I was making pretty much the same point. As
for the pre-XP look and feel, it does pick up some platform settings such
as colours (and possibly fonts, though I'm not certain in that re).
Head over to this site and try the new version, instead of spreading old
and now incorrect information.

I don't believe that I was, again it seems to have been a misunderstanding
with the quoting.

Dan.
 
T

TDOR

SWING: Has all the advanced components, but is slow and
Swing doesn't use skins as such, it has pluggable look and feels, which are
a fair bit more complex than skins. They are generally platform
independent (they are just Java classes after all) though some L&Fs may be
tailored for specific platforms (such as Sun's XP look and feel).

I am not talking about code being platform independant - its the
ui. I don't want to have to detect the platform myself (thats
being plaform dependant!) to apply a skin the mimics the platform
but does this inconsistantly and does not pick up the users settings.

btw. skins are always complex unless you assume they do not scale,
which I have only seen used for some multimedia apps, not desktop
interfaces.
 
J

Jon A. Cruz

T

TDOR

Daniel Dyer said:
OK, fair point, the definition of platform independence I was using was a
bit narrow, but if you want to pick up platform settings you really have to
do it in a platform-specific way. You can't pick-up someone's Windows
settings when running Gnome on Solaris for example, because there aren't
any Windows settings in that case.

Exactly, thats the problem with the SWING way. I think sun left the AWT
- build on top of native widgets - way, so they don't have to figure
out what to do about the differences in the underlying widgets on
different platforms. With SWING they don't have to worry about this
because it draws the widgets itself. But then a new problem appear, that
is, should the widgets pick up the users ui settings? If you wan't to
do that consistantly, then you end up writing lots of platform specific
code, and this might cancel out the time saved when porting widgets that
draw themselves. And many ui settings won't even apply when you draw the
widgets yourself. For that reason I predict that SWING will never be good
at picking up on users ui settings, and if sun does make an effort of
this then it will probably only be half measures and only on windows.
 

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
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top