Hi,
First of all, thank you for the great framework!
I think I’ve hit a wall with something and hoping someone can help me out. I have a CButton that opens up a dialog that performs modification to the content of the dockable. The contents of the dockable do not update until I mouse over the CButton again or any other action button. I think it has something to do with focus. The dockable doesnt seem to repaint itself until it gets focused somehow. I tried giving it focus directly, but that didnt work. Below is the code to illustrate my problem. I am using 1.0.8 version of the framework. Thanks in advance.
package tmp;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
import org.apache.commons.lang.RandomStringUtils;
import bibliothek.gui.dock.common.CControl;
import bibliothek.gui.dock.common.CGridArea;
import bibliothek.gui.dock.common.CLocation;
import bibliothek.gui.dock.common.DefaultSingleCDockable;
import bibliothek.gui.dock.common.action.CButton;
public class DockingFrameTest extends JFrame {
public DockingFrameTest(){
super("Test");
final CControl control = new CControl(this);
CGridArea center = control.createGridArea("center");
add( center.getComponent() );
this.setBounds(200, 200, 200, 200);
JLabel lable = new JLabel("Start");
final DefaultSingleCDockable dockable = new DefaultSingleCDockable( "test" , "test" , lable ) ;
dockable.setCloseable(true);
dockable.setMinimizable(false);
CButton edit = new CButton() {
@Override
protected void action() {
final JTextField text = new JTextField();
JDialog d = new JDialog();
d.getContentPane().add(text);
d.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
d.addWindowListener(new WindowAdapter(){
public void windowClosed(WindowEvent evt) {
dockable.getContentPane().removeAll();
dockable.getContentPane().add(new JLabel(text.getText()));
}
});
d.pack();
d.setLocationRelativeTo(DockingFrameTest.this);
d.setVisible(true);
}
};
edit.setText("edt");
dockable.addAction(edit);
control.add(dockable);
dockable.setLocation(CLocation.base().normalEast(0.5));
dockable.setVisible(true);
}
public static void main(String[] args) {
DockingFrameTest test = new DockingFrameTest();
test.setVisible(true);
}
}