You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by "Matthias Bläsing (JIRA)" <ji...@apache.org> on 2019/03/18 21:22:00 UTC

[jira] [Updated] (NETBEANS-2274) Options Dialog - Panel "Fonts & Colors" - Syntax Pane relies on undocumented ActionEvent#getModifiers behavior

     [ https://issues.apache.org/jira/browse/NETBEANS-2274?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matthias Bläsing updated NETBEANS-2274:
---------------------------------------
     Attachment: Bildschirmfoto_2019-03-18_21-59-36.png
    Description: 
In the Options Dialog, the Panel "Fonts & Colors" and there the subpanel Syntax Pane relies on undocumented ActionEvent#getModifiers behavior.

The constructor of ActionEvent:

[https://docs.oracle.com/javase/8/docs/api/java/awt/event/ActionEvent.html#ActionEvent-java.lang.Object-int-java.lang.String-int-]

Only talks about modifier keys as parameter options:
{quote}{{modifiers}} - The modifier keys down during event (shift, ctrl, alt, meta). Passing negative parameter is not recommended. Zero value means that no modifiers were passed
{quote}
The code in the panel checks for the mask for mouse button 1:
{code:java}
            if(evt.getModifiers() == InputEvent.BUTTON1_MASK) { // mouse clicked
                updateLanguageCombobox();
            }{code}
On Ubuntu 18.10, OpenJDK 1.8u191:
{noformat}
openjdk version "1.8.0_191"
OpenJDK Runtime Environment (build 1.8.0_191-8u191-b12-2ubuntu0.18.10.1-b12)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode){noformat}
As the keyboard handling for the ComboBox is also explicitly coded in the panel:
{code:java}
        cbLanguage.addKeyListener(new java.awt.event.KeyAdapter() {
            @Override
            public void keyReleased(KeyEvent evt) {
                if (evt.getKeyCode() == KeyEvent.VK_ENTER || evt.getKeyCode() == KeyEvent.VK_SPACE) {
                    updateLanguageCombobox();
                }
            }
        });{code}
Both special cases should be removed and replaced with the default combobox behavior.

The attached screenshot shows the broken state (combobox content for language does not match displayed language).

 

  was:
In the Options Dialog, the Panel "Fonts & Colors" and there the subpanel Syntax Pane relies on undocumented ActionEvent#getModifiers behavior.

The constructor of ActionEvent:

[https://docs.oracle.com/javase/8/docs/api/java/awt/event/ActionEvent.html#ActionEvent-java.lang.Object-int-java.lang.String-int-]

Only talks about modifier keys as parameter options:
{quote}{{modifiers}} - The modifier keys down during event (shift, ctrl, alt, meta). Passing negative parameter is not recommended. Zero value means that no modifiers were passed
{quote}
The code in the panel checks for the mask for mouse button 1:
{code:java}
            if(evt.getModifiers() == InputEvent.BUTTON1_MASK) { // mouse clicked
                updateLanguageCombobox();
            }{code}
On Ubuntu 18.10, OpenJDK 1.8u191:
{noformat}
openjdk version "1.8.0_191"
OpenJDK Runtime Environment (build 1.8.0_191-8u191-b12-2ubuntu0.18.10.1-b12)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode){noformat}
As the keyboard handling for the ComboBox is also explicitly coded in the panel:
{code:java}
        cbLanguage.addKeyListener(new java.awt.event.KeyAdapter() {
            @Override
            public void keyReleased(KeyEvent evt) {
                if (evt.getKeyCode() == KeyEvent.VK_ENTER || evt.getKeyCode() == KeyEvent.VK_SPACE) {
                    updateLanguageCombobox();
                }
            }
        });{code}
Both special cases should be removed and replaced with the default combobox behavior.

 


> Options Dialog - Panel "Fonts & Colors" - Syntax Pane relies on undocumented ActionEvent#getModifiers behavior
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: NETBEANS-2274
>                 URL: https://issues.apache.org/jira/browse/NETBEANS-2274
>             Project: NetBeans
>          Issue Type: Bug
>          Components: editor - Options
>    Affects Versions: 11.0
>            Reporter: Matthias Bläsing
>            Assignee: Matthias Bläsing
>            Priority: Major
>         Attachments: Bildschirmfoto_2019-03-18_21-59-36.png
>
>
> In the Options Dialog, the Panel "Fonts & Colors" and there the subpanel Syntax Pane relies on undocumented ActionEvent#getModifiers behavior.
> The constructor of ActionEvent:
> [https://docs.oracle.com/javase/8/docs/api/java/awt/event/ActionEvent.html#ActionEvent-java.lang.Object-int-java.lang.String-int-]
> Only talks about modifier keys as parameter options:
> {quote}{{modifiers}} - The modifier keys down during event (shift, ctrl, alt, meta). Passing negative parameter is not recommended. Zero value means that no modifiers were passed
> {quote}
> The code in the panel checks for the mask for mouse button 1:
> {code:java}
>             if(evt.getModifiers() == InputEvent.BUTTON1_MASK) { // mouse clicked
>                 updateLanguageCombobox();
>             }{code}
> On Ubuntu 18.10, OpenJDK 1.8u191:
> {noformat}
> openjdk version "1.8.0_191"
> OpenJDK Runtime Environment (build 1.8.0_191-8u191-b12-2ubuntu0.18.10.1-b12)
> OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode){noformat}
> As the keyboard handling for the ComboBox is also explicitly coded in the panel:
> {code:java}
>         cbLanguage.addKeyListener(new java.awt.event.KeyAdapter() {
>             @Override
>             public void keyReleased(KeyEvent evt) {
>                 if (evt.getKeyCode() == KeyEvent.VK_ENTER || evt.getKeyCode() == KeyEvent.VK_SPACE) {
>                     updateLanguageCombobox();
>                 }
>             }
>         });{code}
> Both special cases should be removed and replaced with the default combobox behavior.
> The attached screenshot shows the broken state (combobox content for language does not match displayed language).
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists