> > Greetings,
>
[quoted text clipped - 47 lines]
>
> JB.
Yes, the compiler is catching the four listed exceptions, which I find
weird - I thought exceptions were only runtime artifacts. I saw this
try-catch block as an example and didn't implement it. I thought,
"Why can't I just make the calls and let the chips fall where they
may?" But since it won't compile, I'm under the impression that it
simply can't find the UIManager. What's worse, if I try to type the
import statement (I use Eclipse), with each "filtering", I get to the
end of the line and there's no UIManager class anywhere, further
bolstering my opinion that somehow the class isn't even present.
Mike
Jean-Baptiste Nizet - 29 Apr 2008 16:39 GMT
> Yes, the compiler is catching the four listed exceptions, which I find
> weird - I thought exceptions were only runtime artifacts. I saw this
[quoted text clipped - 7 lines]
>
> Mike
Sorry if this sounds rude, but you should probably read a book about
basic Java programming if you don't understand how imports and
exceptions work.
The UIManager class IS present, and you should be able to import it.
BTW, if the compiler signals errors about your code not catching these
exceptions, this means that it has found the class. When the compiler
signals an error, you MUST fix it: the code won't even be compiled and
you won't be able to run it.
Regarding exceptions, Java has two kinds of exceptions: "normal"
exceptions, and runtime exceptions. Runtime exceptions all derive from
the class java.lang.RuntimeException. A runtime exception may be
ignored by the caller of a method that might throw it. But a normal
exception MUST be taken care of by the caller method: either it lets
it go to the parent caller (by declaring "throws FooBarException"), or
it catches it. If the caller method doesn't declare the exception and
doesn't catch it, the compiler will refuse to compile your code.
The example I gave you catches all the declared exceptions, and throws
a runtime exception if it happens (which should never be the case).
JB.
Zerex71 - 29 Apr 2008 17:37 GMT
> > Yes, the compiler is catching the four listed exceptions, which I find
> > weird - I thought exceptions were only runtime artifacts. I saw this
[quoted text clipped - 31 lines]
>
> JB.
I used your code suggestion and the LAF is still the same Windows-
looking thing. I want the Java variety. It's not working for me.
Thomas Kellerer - 30 Apr 2008 07:56 GMT
Zerex71, 29.04.2008 18:37:
> I used your code suggestion and the LAF is still the same Windows-
> looking thing. I want the Java variety. It's not working for me.
From the JavaDocs:
http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/UIManager.html#getCrossPlatf
ormLookAndFeelClassName()
"If the system property swing.crossplatformlaf has been defined, its value will be returned."
Is it possible that you are setting that property somewhere?
Check if you have a swing.properties in your JDK installation which might set that property.
Otherwise you could call getInstalledLookAndFeels() and see which are available in your installation.
Thomas
Zerex71 - 30 Apr 2008 15:53 GMT
On Apr 30, 2:56 am, Thomas Kellerer <YQDHXVLMU...@spammotel.com>
wrote:
> Zerex71, 29.04.2008 18:37:
>
[quoted text clipped - 11 lines]
>
> Thomas
I used Google Desktop to see if it could find a swing.properties file
on my system and it could not. I have never used it and don't know
where it would be on the machine. I will read up on this file and see
what it can do for me.
Thanks,
Mike