>         So public static SwitchPLAFAction { ... } is a just java object class
>         that is really instantied just once, like some sort of singleton?
No, no. I did not mean that static classes are related to singletons.
They are not AFAIK.

>         Actually I have used a modified version of the ActionEvent class from
>         Kim Topley "Core JFC" example in Xsql as an inner class. So now Xsql can
> switch PLAFs too. It works, but I still dont understand public static class ?

This is an example of what I want to say:

// --------File A.java
public class A {
...
public class B { ... }
}
// --------End of file
// --------File C.java
public class C {
...
public static class D { ... }
}
// --------End of file

You can use both classes A.B or C.D in any packages such as both of them
are public. But A.B class has one additional hidden member of A class
and requires one additional constructor parameter of A type (in default
"no-arg" constructor) if you create it outside of A class scope. C.D
class is just like usual Java top level public class.

That's all I know about static classes

Hope this will help.
Pavel


// --------

> 
>         I cant find a reference to it in "Exploring Java". I will see if I can
>         borrow back "Core Java" this weekend.
> 
>         Pete
.. 
> Correct me if I'm wrong, but I do not believe top-level classes can have
> the 'static' modifier applied, but if you want a shared entity, do
> something like this:
> 
> public class DefaultFactory
>    extends AbstractFactory
> {
>    protected DefaultFactory() { /* empty */ } // or private if you wish
>    public final static DefaultFactory SHARED_INSTANCE = new
> DefaultFactory();
>    ...
> }
> 
> This is how I create shared entities (for example in JUMP, a framework for
> numeric computations). The only potential problem you have here is
...

Reply via email to