Downloaded and installed j2sdk142_nbide351. Started Sun's online swing tutorial
and detected problem with example 2:
java.sun.com/docs/books/tutorial/uiswing/learn/example2.html
Ignoring netbeans app, I compile and run from console. Example 2 contains:
lookAndFeel = "com.sun.java.swing.plaf.motif.MotifLookAndFeel"; // (1)
lookAndFeel = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"; // (2)
try {
UIManager.setLookAndFeel(lookAndFeel);
} catch (ClassNotFoundException e) {
...
Without designating classpath, example 2 compiles and runs ok, even when
reference (1) above is invoked. Invoking reference (2) above stalled until I:
1. unzipped the ..\j2sdk142_nbide351\j2sdk1.4.2\src.zip source file
2. added its path to the classpath
3. added the -source 1.4 option to the javac command line (to avoid assert
messages).
4. manually compiled GTKLookAndFeel.java to create GTKLookAndFeel.class
BEFORE running the example.
This method results in the following compile message:
Some input files use or override a deprecated API.
QUESTIONS:
1. Are the above steps 1-4 appropriate? Would the classpath and deprecation
problems have been resolved if I was using the net beans ide instead of the
console? Should I ignore the deprecation message, or does this mean I'm
still doing something wrong?
2. Javac.exe takes significantly longer when the classpath includes the source
files. Is there anything that I can do about this?
3. Without a classpath, javac.exe is still able to process
import java.util.*;
How? Are certain packages (somehow) imbedded into javac.exe for v1.4.2?
If so, which ones?
4. Similarly, why did UIManager.setLookAndFeel(lookAndFeel) work correctly
without a classpath when
lookAndFeel = "com.sun.java.swing.plaf.motif.MotifLookAndFeel";
was invoked but not when
lookAndFeel = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel";
was invoked. Example 2 stalled until I manually compiled
GTKLookAndFeel.java to create GTKLookAndFeel.class BEFORE running the
example. I infer that the
UIManager.setLookAndFeel(lookAndFeel)
requires that the *.class file pre-exist. If I'm correct, why did
UIManager.setLookAndFeel("...MotifLookAndFeel")
work correctly WITHOUT a classpath, and WITHOUT first creating
MotifLookAndFeel.class?