Possible regressionn, popupmenus not appearing to work correctly with cntl-click

Paul Taylor paul_t100 at fastmail.fm
Thu Oct 31 04:27:32 PDT 2013


On 31/10/2013 11:11, Leonid Romanov wrote:
> I see.. While it might pose an inconvenience in some scenarios on OS 
> X, I don't think it's an issue, since Apple JDK 6 behaves the same 
> way, so I'm going to close the bug.
>
Okay no problem, I now have it working for me since using 
setComponentPopup(). The only thing I would say is that is if Cntl-Click 
is meant to work the same as Right-Click on OSX in all situations it 
does seem there is a minor issue that it breaks my old code but this is 
no longer a problem for me.

> On 29.10.2013, at 15:14, Paul Taylor <paul_t100 at fastmail.fm 
> <mailto:paul_t100 at fastmail.fm>> wrote:
>
>> On 28/10/2013 12:29, Leonid Romanov wrote:
>>> Hello,
>>> I've filed a bug:
>>> https://bugs.openjdk.java.net/browse/JDK-8027374
>>>
>> Hi, Ive think Ive found the issue for me , I created this test case 
>> and it works correctly as you say
>>
>> import javax.swing.*;
>>
>> public class TableTest
>> {
>>     public static void main(String[] args) throws Exception
>>     {
>>         JPopupMenu popup = new JPopupMenu("Popup");
>>         popup.add(new JMenuItem("Copy"));
>>         JTable test = new JTable(5,5);
>>         test.setComponentPopupMenu(popup);
>>         test.setRowSelectionAllowed(true);
>>         test.setColumnSelectionAllowed(true);
>> UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
>>         JFrame frame = new JFrame();
>>         frame.add(test);
>>         frame.pack();
>>         frame.setVisible(true);
>>     }
>> }
>>
>> But if you comment out the line
>>
>>         test.setComponentPopupMenu(popup);
>>
>> so that there is no popup menu then it doesn't work, CntlClick will 
>> change the selection.
>>
>> Whether this is a bug, or correct behaviour Im not sure  ?
>>
>> But the reason why this is causing an issue for me in my current code 
>> is that Im not using setComponentPopupMenu()instead I'm adding a 
>> mouse handler to the table that then decides whether or not to show a 
>> popup menu so I guess the logic for Jtable must not detect that it 
>> has a popup menu in this case. I've checked and the method was not 
>> added to JTable until Java 1.5 and my code was started before then so 
>> hopefully I can just update my code to  use the method and the 
>> problem will go away for me.
>>
>> Paul
>>
>>
>



More information about the macosx-port-dev mailing list