JDK-4992223 : Missing context menu for text components
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 5.0
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2004-02-10
  • Updated: 2017-05-23
Related Reports
Relates :  
Description
Name: gm110360			Date: 02/10/2004


FULL PRODUCT VERSION :
1.5 Beta 1

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]

EXTRA RELEVANT SYSTEM CONFIGURATION :
Not Applicable

A DESCRIPTION OF THE PROBLEM :
In windowsXP l&F, swing is missing context menu for text components.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Screenshot comparisons can be seen on the following link:
https://winlaf.dev.java.net/release_0.4.html#Issue3

REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER SUBMITTED WORKAROUND :
Use the following SWING PATCH/HACK:
https://winlaf.dev.java.net/release_0.4.html
(Incident Review ID: 237454) 
======================================================================

Comments
EVALUATION Name: anR10225 Date: 02/19/2004 The context menu in Windows (since NT 4.0) for edit controls is set by default even while the ContextMenu property of a control has null value. The following menu items are included into this menu: . Undo : the simpliest undo/redo implementation. Only a single last change is stored which is undone on the first menu select and is redone on the second. The item is disabled if no edits is done at the moment . Cut . Copy : performs cut/copy action with the selected text. Items are disabled if no text is currently selected. . Paste: pastes the clipboard content at the cursor position. It is disabled if the clipboard contains no acceptable (text) content. . Delete: removes the selected text. Disabled if no text is currently selected . Select All: selects all text. Disabled if all text is currently selected. ====================================================================== Name: anR10225 Date: 02/20/2004 The problem arises with the Undo item. Currently we have no default undo/redo functionality supported for text components. The way developers add undo/redo feature to a text component is by addUnoableEditListener(). Since we couldn't track whether client adds its own undo manager we couldn't supply a default one. Two UndoManagers may conflict with each other. The way out is to leave a stub for undo functionality by the way of action (name it "undo-edit" for example). If this action is not specified the 'Undo' item is always disabled. If developer wants to add this functionality he should add "undo-edit" action into a specified text component or into default action map. In this case the enabled state of the item is specified by the enable state of the "undo-edit" action. ====================================================================== Name: anR10225 Date: 02/25/2004 also the focus should be gained by the text component which displays context menu. User should be able to see the text selection which he is going to Copy/Cut/Delete. It also looks strange when one for example choose 'Select All' from a context menu but the text remains 'unselected' (selection is not visible). Native Windows interface gives the focus to the text component on right mouse click. ====================================================================== Name: anR10225 Date: 02/26/2004 We can't just simply add a popup menu to all text components by default since we could potentially break backward compatibility. Some application may add its own popup menu to a text component and it is not definite what menu will display. We also couldn't determine whether client sets it's own menu since it may be set by the way of addMouseListener(). So we shouldn't change the default behavior and may add this as option. This may be specified by LAF default value. This feature may also be added to GTK and Metal LAFs. ======================================================================
25-09-2004