Sorry for the wrong signal... but I have tried to found the problem for 5 hours and I found the solution only now.
I have found a code to reproduce the problem... founding the workaround to solve my problem.
If in the code on the
DefaultDockableBarDockableHolder i do a
setLayout(new BorderLayout()) before to load the layout the window become gray. If i don't set the layout the problem is not present.
I have removed the setLayout from the code because it have no sense. It was in a previous method no more needed.
The code to reproduce the problem is:
- Code: Select all
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import com.jidesoft.action.*;
import com.jidesoft.docking.DockableFrame;
import com.jidesoft.swing.*;
public class DefaultDockableBarDockableHolderBug extends DefaultDockableBarDockableHolder{
public DefaultDialogDockableBarDockableHolderBug(boolean initLayout) {
super();
init(initLayout);
}
private void init(boolean initLayout) {
if(initLayout)
setLayout(new BorderLayout());
setDefaultCloseOperation(EXIT_ON_CLOSE);
getLayoutPersistence().setProfileKey("bug.test");
getLayoutPersistence().beginLoadLayoutData();
this.getDockableBarManager().addDockableBar(CommandBarFactory.createLookAndFeelCommandBar(this));
this.getDockableBarManager().addDockableBar(getMyMenuBar());
JTextArea ta = new JTextArea("test test test test\n test test test test\n"+
"test test test test\n test test test test\n"+
"test test test test\n test test test test\n"+
"test test test test\n test test test test\n");
getDockingManager().setShowWorkspace(false);
DockableFrame df = new DockableFrame("eeeee");
df.add(ta);
getDockingManager().addFrame(df);
getLayoutPersistence().loadLayoutData();
}
private CommandBar getMyMenuBar() {
CommandBar commandBar = new CommandMenuBar("Menu Bar");
commandBar.setInitSide(DockableBarContext.DOCK_SIDE_NORTH);
commandBar.setInitIndex(0);
commandBar.setPaintBackground(false);
commandBar.setStretch(true);
commandBar.setFloatable(true);
commandBar.setHidable(false);
JideMenu file= new JideMenu("File");
AbstractAction a = new AbstractAction("SaveLayout"){
public void actionPerformed(ActionEvent e) {
getLayoutPersistence().saveLayoutData();
JOptionPane.showMessageDialog(DefaultDialogDockableBarDockableHolderBug.this, "Layout saved");
}
};
a.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_DOWN_MASK));
JMenuItem i = new JMenuItem(a);
file.add(i);
commandBar.add(file);
commandBar.getContext().setInitMode(DockableBarContext.STATE_HORI_DOCKED);
return commandBar;
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable(){
public void run() {
final JFrame f = new JFrame("test");
JButton b = new JButton("show dialog");
final JCheckBox cb = new JCheckBox("setLayout before");
b.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
SwingUtilities.invokeLater(new Runnable(){
public void run() {
new DefaultDockableBarDockableHolderBug(cb.isSelected());
}
});
}
});
f.getContentPane().setLayout(new FlowLayout());
f.getContentPane().add(b);
f.getContentPane().add(cb);
f.pack();
JideSwingUtilities.globalCenterWindow(f);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
}
});
}
}
Thanks