public Command myKeyEvent(KeyStroke stroke) { myGetKeyCommands(); if (showTrailCommand != null && showTrailCommand.matches(stroke)) { final ChangeTracker tracker = new ChangeTracker(this); if (globallyVisible) { globalVisibility = !globalVisibility; } else { localVisibility = !localVisibility; } redraw(); return tracker.getChangeCommand(); } return null; }
public KeyCommand[] myGetKeyCommands() { if (commands == null) { if (trailKey != null) { showTrailCommand = new KeyCommand(menuCommand, trailKey, Decorator.getOutermost(this), this); } if (showTrailCommand != null && menuCommand.length() > 0) { commands = new KeyCommand[] {showTrailCommand}; } else { commands = new KeyCommand[0]; } } if (showTrailCommand != null) { showTrailCommand.setEnabled(getMap() != null); } return commands; }