Hello !
I try to add a popup menu on the CContentArea but this seems to work only on minimize areas and not on the center of the area. How add a popup menu on the CContentArea ?
import javax.swing.JFrame;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import bibliothek.gui.dock.common.CContentArea;
import bibliothek.gui.dock.common.CControl;
public class ContextMenu {
public ContextMenu() {
final JPopupMenu contextMenu = new JPopupMenu("Edit");
contextMenu.add(makeMenuItem("Save"));
contextMenu.add(makeMenuItem("Save As"));
contextMenu.add(makeMenuItem("Close"));
JFrame frame = new JFrame();
final CControl control = new CControl(frame);
CContentArea contentArea = control.getContentArea();
frame.add(contentArea);
JPanel panel = contentArea;//new JPanel();
frame.add(panel);
panel.setComponentPopupMenu(contextMenu);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(400, 200);
frame.setVisible(true);
}
private JMenuItem makeMenuItem(String label) {
JMenuItem item = new JMenuItem(label);
return item;
}
public static void main(String[] args) {
new ContextMenu();
}
}
Thanks.
Gilles