ModernDocking: JPanels that extend Dockable do not receive KeyListener events
version 0.11.0-SNAPSHOT window 11 Java 21
public class DockingPanel extends JPanel implements Dockable {
private final String tabText;
private final String persistentID = UUID.randomUUID().toString();
public DockingPanel(String tabText) {
super(new BorderLayout());
this.tabText = tabText;
Docking.registerDockable(this);
this.setFocusable(true);
this.addKeyListener(new KeyAdapter() {
@Override
public void keyTyped(KeyEvent e) {
System.out.println("keyTyped="+e);
super.keyTyped(e);
}
@Override
public void keyPressed(KeyEvent e) {
System.out.println("keyPressed="+e);
super.keyPressed(e);
}
@Override
public void keyReleased(KeyEvent e) {
System.out.println("keyReleased="+e);
super.keyReleased(e);
}
});
}
@Override
public String getPersistentID() {
return persistentID;
}
@Override
public String getTabText() {
return tabText;
}
public static void main(String[] args) {
JFrame frame = new JFrame("DockingPanel Test");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(800,600);
frame.setLocationByPlatform(true);
Docking.initialize(frame);
DockingUI.initialize();
ModernDocking.settings.Settings.setAlwaysDisplayTabMode(true);
ModernDocking.settings.Settings.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
frame.add(new RootDockingPanel(frame), BorderLayout.CENTER);
Docking.dock(new DockingPanel("Test"), frame, DockingRegion.CENTER);
frame.setVisible(true);
}
System.out messages never fire.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (9 by maintainers)
I confirm this works both ways in tab groups. if you are at the left-most and press left, it wraps. not a problem.
Building now. I don’t see a way to make releases/tags from the GitHub mobile app, which is frustrating. Had to wait till I was at my computer. I might see if I can automate updating each build if the version ends with SNAPSHOT.