Hello,
I have a JFrame with CWorkingArea. In that area I will open many DefaultMultipleCDockable.
I want to create a MyDefaultMultipleCDockable for insert in it specific properties of my program.
If i create
public class WMSMultipleDockable extends DefaultMultipleCDockable
I receive the error
symbol : constructor DefaultMultipleCDockable()
location: class bibliothek.gui.dock.common.DefaultMultipleCDockable```
Is it possible to have a new version of DefaultMultipleCDockable with the constructor without parameters?
I'm currently use the last version of library
Thanks
Monica
No, because every MultipleCDockable must have a factory (of type MultipleCDockableFactory) and the constructor of DefaultMultipleCDockable ensures that you cannot forget this factory. Also you cannot exchange the factory once it is set (changing a factory would introduce a lot confusion).
CControl also performs additional checks ensuring that the factories are set, if there would be a default constructor you could get a runtime-exception instead of a compiler-error. Personally I like to know any problems as soon as possible .
Please also note that the CControl must know the factory (you must call „CControl.add(String,MultipleCDockableFactory)“)
The factories are required to persistently store the layout of your application. Since almost any application implements persistent storage of the layout, I don’t implemented any option not to set the factories. Although you can implement some very simple factory which does not store anything…
This is correct, but if I want extend this class actually i cannot do it!
In this moment I can create
public class MyMultipleDockable extends DefaultCDockable implements MultipleCDockable
but I lost the facilities into DefaultMultipleCDockable and the new logic of future release
I choose to create a wrapper class that contains a DefaultMultipleCDockable, this works fine, but when I use focusGained of CFocusListener() it returns a CDockable not my wrapper obviously -_-
I’ve resolved this saving MyMultipleDockable into a component that insert into MultipleCDockable but, for get it, I must do a lot of code
ex:
for (int i = 0; i < aDockable.getContentPane().getComponentCount(); i++) {
Component component = aDockable.getContentPane().getComponent(i);
if (component instanceof JScrollPane) {
for (int j = 0; j < ((JScrollPane) component).getComponentCount(); j++) {
...
}
}
}
Is there a method that returns a component inserted into DefaultMultipleCDockable?
new DefaultMultipleCDockable(factory, new JScrollPane(myComponent));
Yes I know the keyword “super” but it doesn’t resolve my problem: I want DefaultMultipleCDockable not DefaultCDocakble.
But no problem, I used another mode to do it
Thank you
AAAAAArgh, my example was wrong. SORRY, let’s try this again. Although by now the example is perhaps a bit out-dated. But this way you extend a DefaultMultipleCDocakble.
// one way, forwarding the factory
public MyMultipleDockable( MultipleCDockableFactory factory ){
super( factory ); // <<--- here, call to the correct super constructor
}
// or this way
public MyMultipleDockable(){
this( SomeObject.STATIC_FINAL_REFERENCE_TO_FACTORY );
}
}```