How do I REMOVE swing from the AWT ?

T

Thomas Hawtin

U. George said:
A recent bug in the JDK1.6 beta had a stack trace showed that the AWT
explicitly called some javax.swing classes. My program does not
explicitly use any swing classes, methods, ... I was surprised. And
dismayed.

Why dismayed?

What you probably saw was a stack trace showing XAWT. XAWT is an
implementation of AWT components on X11 using Swing. In Mustang XAWT is
the default on both Linux and Solaris. You can still configure it to use
Motif.

Something similar to XAWT was planned for Windows, but it hasn't been
implemented yet.

There are also a couple of other dependencies. grep -R is your friend.

What I suggest you do is forget about ye olde AWT widgets and use Swing.

Tom Hawtin
 
U

U. George

There are lots of tutorials on how to use swing in your application. Are
there any tutorials on how not to use swing?

A recent bug in the JDK1.6 beta had a stack trace showed that the AWT
explicitly called some javax.swing classes. My program does not
explicitly use any swing classes, methods, ... I was surprised. And
dismayed.

How well known is it that the AWT uses swing in its normal operation.

And how does one remove those references to swing? Or how do I become
swing-free?


You can see how much swing is integrated into the awt by removing the
javax.swing tree in RT.JAR
 
T

Thomas Hawtin

Thomas said:
Good advice in general, and my consistent advice as well. However there
have been arguments made to me in the past for using AWT. The memory that
raises first in me noggin is a startup splash screen showing initialization
progress, because it loads in no time flat compared to swing. Or used to
anyway.

As it was 1.6 we were talking about, there is now the option of java
-splash.

Tom Hawtin
 
T

Thomas G. Marshall

Thomas Hawtin said something like:
Why dismayed?

<Anal Alert Claxon/> ("dwee dwee dwee dwee dwee...")

Because in its cleanest incarnation one would have expected Swing to have
the AWT as a dependency, *NOT* the other way around. It was originally
billed as a layered technology: having backward hooks from AWT to swing
gives me (and should give you) the technical term called The Heebeejeebees
(tm).

What you probably saw was a stack trace showing XAWT. XAWT is an
implementation of AWT components on X11 using Swing. In Mustang XAWT is
the default on both Linux and Solaris. You can still configure it to use
Motif.

I have a windows implementation and see a page+ of dependencies /anyway/, as
you suggest below with your "grep -R" suggestion. For yucks, I'll list them
here:

<@#$%ing Gross Pasted Example>
$ find . -type f -exec fgrep swing {} /dev/null \;
Binary file ./.Component.java.swp matches
../Button.java: * @see javax.swing.AbstractButton#isSelected()
../Component.java: * <a
href="http://java.sun.com/docs/books/tutorial/uiswing/mis
c/focus.html">
../Component.java: Package swingPackage =
Package.getPackage("javax.swing"
);
../Component.java: if (klass.getPackage() == swingPackage &&
../Component.java: final Class swingClass = klass;
../Component.java:
return swingClass.getDeclaredMethods();
../Component.java: if (this instanceof javax.swing.JComponent) {
../Component.java: if (((javax.swing.JComponent)
this).isOpaque())
{
../Container.java:import javax.swing.JRootPane;
../Container.java: * <a
href="http://java.sun.com/docs/books/tutorial/uiswing/mis
c/focus.html">
../Container.java: * @see javax.swing.JComponent#revalidate()
../Container.java: * @see javax.swing.JComponent#revalidate()
../Container.java: * @see javax.swing.JComponent#revalidate()
../Container.java: * @see javax.swing.JComponent#revalidate()
../Container.java: * @see javax.swing.JComponent#revalidate()
../Container.java: Component predictedFocusOwner = (this instanceof
javax
..swing.JInternalFrame) ?
((javax.swing.JInternalFrame)(this)).getMostRecentFocus
Owner() : null;
../datatransfer/DataFlavor.java: * <a
href="http://java.sun.com/docs/books/tutori
al/uiswing/misc/dnd.html">
../datatransfer/Transferable.java: * <a
href="http://java.sun.com/docs/books/tuto
rial/uiswing/misc/dnd.html">
../DefaultFocusTraversalPolicy.java: * <a
href="http://java.sun.com/docs/books/tu
torial/uiswing/misc/focus.html">
../DefaultKeyboardFocusManager.java: * <a
href="http://java.sun.com/docs/books/tu
torial/uiswing/misc/focus.html">
../dnd/DropTarget.java:import javax.swing.Timer;
../event/MouseWheelEvent.java: * @see javax.swing.JScrollPane
../event/MouseWheelEvent.java: * @see
javax.swing.JScrollPane#setWheelScrollingEn
abled(boolean)
../event/MouseWheelEvent.java: * @see
javax.swing.Scrollable#getScrollableUni
tIncrement
../event/MouseWheelEvent.java: * @see
javax.swing.Scrollable#getScrollableBlo
ckIncrement
../event/MouseWheelEvent.java: * @see javax.swing.Scrollable
../event/MouseWheelEvent.java: * @see
javax.swing.Scrollable#getScrollableUni
tIncrement
../event/MouseWheelEvent.java: * @see javax.swing.JScrollPane
../event/MouseWheelEvent.java: * @see
javax.swing.JScrollPane#setWheelScrolli
ngEnabled
../event/WindowListener.java: * @see <a
href="http://java.sun.com/docs/books/tuto
rial/uiswing/events/windowlistener.html">Tutorial: How to Write Window
Listeners
</a>
../EventDispatchThread.java: if (modalComp instanceof
javax.swing.JInterna
lFrame) {
../FocusTraversalPolicy.java: * <a
href="http://java.sun.com/docs/books/tutorial/
uiswing/misc/focus.html">
../Frame.java: * @see
javax.swing.JFrame#setDefaultLookAndFeelDecorated(bo
olean)
../Frame.java: * @see javax.swing.Icon
../Frame.java: * @see javax.swing.Icon
../im/spi/InputMethodContext.java:import javax.swing.JFrame;
../KeyboardFocusManager.java: * <a
href="http://java.sun.com/docs/books/tutorial/
uiswing/misc/focus.html">
../MenuItem.java: * @see javax.swing.AbstractButton#isSelected()
../TextComponent.java:import javax.swing.text.AttributeSet;
../Toolkit.java: * <a
href="http://java.sun.com/docs/books/tutorial/uiswing/misc/
focus.html#transferTiming">Timing
../Toolkit.java: * <a
href="http://java.sun.com/docs/books/tutorial/uiswing/">The
Swing
../Toolkit.java: * <code>javax.swing.text.JTextComponent</code> already
adher
e to this
../Toolkit.java: * @see javax.swing.text.JTextComponent
$ pwd
/cygdrive/c/Java/jdk1.5.0/src/java/awt
$
Something similar to XAWT was planned for Windows, but it hasn't been
implemented yet.

There are also a couple of other dependencies. grep -R is your friend.

What I suggest you do is forget about ye olde AWT widgets and use Swing.

Good advice in general, and my consistent advice as well. However there
have been arguments made to me in the past for using AWT. The memory that
raises first in me noggin is a startup splash screen showing initialization
progress, because it loads in no time flat compared to swing. Or used to
anyway.



--
Unix users who vehemently argue that the "ln" command has its arguments
reversed do not understand much about the design of the utilities. "ln arg1
arg2" sets the arguments in the same order as "mv arg1 arg2". Existing file
argument to non-existing argument. And in fact, mv itself is implemented as
a
link followed by an unlink.
 
T

Thomas G. Marshall

Thomas G. Marshall said something like:
Thomas Hawtin said something like:

<Anal Alert Claxon/> ("dwee dwee dwee dwee dwee...")

Because in its cleanest incarnation one would have expected Swing to have
the AWT as a dependency, *NOT* the other way around. It was originally
billed as a layered technology: having backward hooks

As further evidence of a complete WOT, I pondered this: are they backward or
forward hooks? ;)

from AWT to swing
gives me (and should give you) the technical term called The Heebeejeebees
(tm).


....[rip]...

--
Unix users who vehemently argue that the "ln" command has its arguments
reversed do not understand much about the design of the utilities. "ln arg1
arg2" sets the arguments in the same order as "mv arg1 arg2". Existing file
argument to non-existing argument. And in fact, mv itself is implemented as
a
link followed by an unlink.
 
U

U. George

Thomas said:
Why dismayed?

What you probably saw was a stack trace showing XAWT. XAWT is an
implementation of AWT components on X11 using Swing. In Mustang XAWT is
the default on both Linux and Solaris. You can still configure it to use
Motif.

Something similar to XAWT was planned for Windows, but it hasn't been
implemented yet.

There are also a couple of other dependencies. grep -R is your friend.

What I suggest you do is forget about ye olde AWT widgets and use Swing.

Tom Hawtin

As this moment I cant. Ever since the duality of "export
AWT_TOOLKIT=MToolkit" and to NOT "#export AWT_TOOLKIT=MToolkit"
I have been plagued with inconsistencies in the JDK. Most notably is the
(non) issueing of mouse events. With motif/jdk1.5 i dont get events.
without motif/jdk1.5 i get the mouse events. Some times the events
appear before the widget is painted, sometimes after. Depending on which
jdk, which motif. Then the non-motif is too slow ( eats up much cpu time
). repaints too much.

BTW: i have just tried with MToolkit, and javax.swing is not imported.
So with 1.5 i cannot use Mtoolkit, as my events are missing. There is
hope with 1.6, as i can begin testing again, with MToolkit, with the
hope that the broken swing classes that may not be used.
 
U

U. George

Roedy said:
I think he might have been worried that AWT would stop working on old
Swingless JVMs.

the AWT does not work consistantly NOW. XAWT( and friends ) does not
work consistently NOW. Instead of really fixing one, i have two
'visions' to contend with. And each release there is some things that
gets fixed, and other things that get broken.
Swing is so much more 'new' overhead, where the issues with the old bugs
are just not being addressed in a timely fashion.
 
R

Rhino

U. George said:
the AWT does not work consistantly NOW. XAWT( and friends ) does not work
consistently NOW. Instead of really fixing one, i have two 'visions' to
contend with. And each release there is some things that gets fixed, and
other things that get broken.
Swing is so much more 'new' overhead, where the issues with the old bugs
are just not being addressed in a timely fashion.

Maybe you should go with SWT?? I don't know if it has any dependencies with
AWT or Swing though; if it does, it might be even worse than your current
situation.
 
T

Thomas G. Marshall

Thomas Hawtin said something like:
As it was 1.6 we were talking about, there is now the option of java
-splash.

Tom Hawtin

Thanks for that---I was unaware of it! And I am greatly pleased that there
is an overlay with alpha for displaying a progress indicator !

Cool (and long needed) @#$%.
 
U

U. George

Rhino said:
Maybe you should go with SWT?? I don't know if it has any dependencies with
AWT or Swing though; if it does, it might be even worse than your current
situation.

SWT appears to be just an AWT, just like XAWT. Besides having control
over the source, what would make SWT better, presuming that u dont
include the learning curve.

The real fun in all of this is when u try other 'window' like systems,
that just dont behave in same fashion.
 

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,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top