{"action":"created","issue":{"url":"https://api.github.com/repos/joel-costigliola/assertj-swing/issues/169","repository_url":"https://api.github.com/repos/joel-costigliola/assertj-swing","labels_url":"https://api.github.com/repos/joel-costigliola/assertj-swing/issues/169/labels{/name}","comments_url":"https://api.github.com/repos/joel-costigliola/assertj-swing/issues/169/comments","events_url":"https://api.github.com/repos/joel-costigliola/assertj-swing/issues/169/events","html_url":"https://github.com/joel-costigliola/assertj-swing/issues/169","id":120566444,"number":169,"title":"Clicking on disabled Swing components","user":{"login":"aguelle","id":11047035,"avatar_url":"https://avatars3.githubusercontent.com/u/11047035?v=3","gravatar_id":"","url":"https://api.github.com/users/aguelle","html_url":"https://github.com/aguelle","followers_url":"https://api.github.com/users/aguelle/followers","following_url":"https://api.github.com/users/aguelle/following{/other_user}","gists_url":"https://api.github.com/users/aguelle/gists{/gist_id}","starred_url":"https://api.github.com/users/aguelle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aguelle/subscriptions","organizations_url":"https://api.github.com/users/aguelle/orgs","repos_url":"https://api.github.com/users/aguelle/repos","events_url":"https://api.github.com/users/aguelle/events{/privacy}","received_events_url":"https://api.github.com/users/aguelle/received_events","type":"User","site_admin":false},"labels":[{"id":76854862,"url":"https://api.github.com/repos/joel-costigliola/assertj-swing/labels/documentation","name":"documentation","color":"006b75","default":false},{"id":79407066,"url":"https://api.github.com/repos/joel-costigliola/assertj-swing/labels/Improvement","name":"Improvement","color":"fbca04","default":false},{"id":79407285,"url":"https://api.github.com/repos/joel-costigliola/assertj-swing/labels/Trivial","name":"Trivial","color":"207de5","default":false}],"state":"closed","locked":false,"assignee":{"login":"croesch","id":307434,"avatar_url":"https://avatars3.githubusercontent.com/u/307434?v=3","gravatar_id":"","url":"https://api.github.com/users/croesch","html_url":"https://github.com/croesch","followers_url":"https://api.github.com/users/croesch/followers","following_url":"https://api.github.com/users/croesch/following{/other_user}","gists_url":"https://api.github.com/users/croesch/gists{/gist_id}","starred_url":"https://api.github.com/users/croesch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/croesch/subscriptions","organizations_url":"https://api.github.com/users/croesch/orgs","repos_url":"https://api.github.com/users/croesch/repos","events_url":"https://api.github.com/users/croesch/events{/privacy}","received_events_url":"https://api.github.com/users/croesch/received_events","type":"User","site_admin":false},"assignees":[{"login":"croesch","id":307434,"avatar_url":"https://avatars3.githubusercontent.com/u/307434?v=3","gravatar_id":"","url":"https://api.github.com/users/croesch","html_url":"https://github.com/croesch","followers_url":"https://api.github.com/users/croesch/followers","following_url":"https://api.github.com/users/croesch/following{/other_user}","gists_url":"https://api.github.com/users/croesch/gists{/gist_id}","starred_url":"https://api.github.com/users/croesch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/croesch/subscriptions","organizations_url":"https://api.github.com/users/croesch/orgs","repos_url":"https://api.github.com/users/croesch/repos","events_url":"https://api.github.com/users/croesch/events{/privacy}","received_events_url":"https://api.github.com/users/croesch/received_events","type":"User","site_admin":false}],"milestone":null,"comments":1,"created_at":"2015-12-05T15:38:32Z","updated_at":"2017-04-28T16:26:18Z","closed_at":"2016-02-15T18:32:18Z","body":" I have a disabled JTable that provides a popup menu:\n\n```\npublic class DisabledTableFrame extends JFrame {\n\npublic DisabledTableFrame() {\n\n    setSize(200, 100);\n    setTitle(getClass().getCanonicalName());\n    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);\n    JTable table = new JTable();\n    add(table);\n\n    table.addMouseListener(new MouseAdapter() {\n\n        @Override\n        public void mousePressed(MouseEvent e) {\n            mouseReleased(e);\n        }\n\n        @Override\n        public void mouseReleased(MouseEvent e) {\n            new PopupMenu();\n        }\n\n    });\n\n    table.setEnabled(false);\n    setVisible(true);\n}\n\npublic static void main(String[] args) {\n    new DisabledTableFrame();\n\n}\n\nprivate class PopupMenu extends JPopupMenu {\n\n    public PopupMenu() {\n\n        JMenuItem menuItem = new JMenuItem(\"TEST\");\n        add(menuItem);\n        setVisible(true);\n    }\n}\n}\n```\n\nI need to open the popup menu when the table is disabled and click a menu item. Unfortunately the ComponentPreconditions.checkEnabled() function throws an IllegalStateException when trying this with AssertJ swing. However you can see that opening a popup menu on a disabled component is a valid action in Swing.\n"},"comment":{"url":"https://api.github.com/repos/joel-costigliola/assertj-swing/issues/comments/298043809","html_url":"https://github.com/joel-costigliola/assertj-swing/issues/169#issuecomment-298043809","issue_url":"https://api.github.com/repos/joel-costigliola/assertj-swing/issues/169","id":298043809,"user":{"login":"aguelle","id":11047035,"avatar_url":"https://avatars3.githubusercontent.com/u/11047035?v=3","gravatar_id":"","url":"https://api.github.com/users/aguelle","html_url":"https://github.com/aguelle","followers_url":"https://api.github.com/users/aguelle/followers","following_url":"https://api.github.com/users/aguelle/following{/other_user}","gists_url":"https://api.github.com/users/aguelle/gists{/gist_id}","starred_url":"https://api.github.com/users/aguelle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aguelle/subscriptions","organizations_url":"https://api.github.com/users/aguelle/orgs","repos_url":"https://api.github.com/users/aguelle/repos","events_url":"https://api.github.com/users/aguelle/events{/privacy}","received_events_url":"https://api.github.com/users/aguelle/received_events","type":"User","site_admin":false},"created_at":"2017-04-28T16:26:18Z","updated_at":"2017-04-28T16:26:18Z","body":"Unfortunately this is not solved. Clicking on disabled components still does not work.\r\n\r\n```\r\nimport java.awt.event.MouseAdapter;\r\nimport java.awt.event.MouseEvent;\r\nimport java.io.IOException;\r\n\r\nimport javax.swing.JFrame;\r\nimport javax.swing.JMenuItem;\r\nimport javax.swing.JPopupMenu;\r\nimport javax.swing.JTable;\r\n\r\nimport org.assertj.swing.data.TableCell;\r\nimport org.assertj.swing.edt.GuiActionRunner;\r\nimport org.assertj.swing.edt.GuiQuery;\r\nimport org.assertj.swing.fixture.FrameFixture;\r\nimport org.assertj.swing.junit.testcase.AssertJSwingJUnitTestCase;\r\nimport org.junit.Rule;\r\nimport org.junit.Test;\r\nimport org.junit.rules.TemporaryFolder;\r\n\r\n/**\r\n * Test for <a\r\n * href=\"https://github.com/joel-costigliola/assertj-swing/issues/169\"\r\n * >github.com - assertj-swing #169</a>\r\n */\r\npublic class GitHub_169_DisabledComponentTest extends AssertJSwingJUnitTestCase {\r\n\r\n\t@Rule\r\n\tpublic TemporaryFolder temporaryFolder = new TemporaryFolder();\r\n\r\n\tprotected FrameFixture window;\r\n\r\n\t@Override\r\n\tprotected void onSetUp() {\r\n\t\tDisabledTableFrame mainFrame = GuiActionRunner\r\n\t\t\t\t.execute(new GuiQuery<DisabledTableFrame>() {\r\n\r\n\t\t\t\t\tprotected DisabledTableFrame executeInEDT() {\r\n\r\n\t\t\t\t\t\treturn new DisabledTableFrame();\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\r\n\t\twindow = new FrameFixture(robot(), mainFrame);\r\n\t}\r\n\r\n\t@Test\r\n\tpublic void openPopupMenu() throws IOException {\r\n\t\twindow.table().showPopupMenuAt(TableCell.row(0).column(0));\r\n\t}\r\n\r\n\tclass DisabledTableFrame extends JFrame {\r\n\r\n\t\tpublic DisabledTableFrame() {\r\n\r\n\t\t\tsetSize(200, 100);\r\n\t\t\tsetTitle(getClass().getCanonicalName());\r\n\t\t\tsetDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);\r\n\t\t\tJTable table = new JTable();\r\n\t\t\tadd(table);\r\n\r\n\t\t\ttable.addMouseListener(new MouseAdapter() {\r\n\r\n\t\t\t\t@Override\r\n\t\t\t\tpublic void mousePressed(MouseEvent e) {\r\n\t\t\t\t\tmouseReleased(e);\r\n\t\t\t\t}\r\n\r\n\t\t\t\t@Override\r\n\t\t\t\tpublic void mouseReleased(MouseEvent e) {\r\n\t\t\t\t\tnew PopupMenu();\r\n\t\t\t\t}\r\n\r\n\t\t\t});\r\n\r\n\t\t\ttable.setEnabled(false);\r\n\t\t\tsetVisible(true);\r\n\t\t}\r\n\t}\r\n\r\n\tclass PopupMenu extends JPopupMenu {\r\n\r\n\t\tpublic PopupMenu() {\r\n\r\n\t\t\tJMenuItem menuItem = new JMenuItem(\"TEST\");\r\n\t\t\tadd(menuItem);\r\n\t\t\tsetVisible(true);\r\n\t\t}\r\n\t}\r\n}\r\n```\r\nResults in:\r\n\r\n```\r\njava.lang.IllegalStateException: Expecting component javax.swing.JTable[name=null, rowCount=0, columnCount=0, enabled=false, visible=true, showing=true] to be enabled\r\n\tat org.assertj.swing.driver.ComponentPreconditions.checkEnabled(ComponentPreconditions.java:66)\r\n\tat org.assertj.swing.driver.ComponentPreconditions.checkEnabledAndShowing(ComponentPreconditions.java:46)\r\n\tat org.assertj.swing.driver.JTableDriver.scrollToCell(JTableDriver.java:503)\r\n\tat org.assertj.swing.driver.JTableDriver.lambda$8(JTableDriver.java:495)\r\n\tat org.assertj.swing.edt.GuiActionRunner$1.executeInEDT(GuiActionRunner.java:75)\r\n\tat org.assertj.swing.edt.GuiQuery.run(GuiQuery.java:42)\r\n\tat java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)\r\n\tat java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)\r\n\tat java.awt.EventQueue.access$500(EventQueue.java:97)\r\n\tat java.awt.EventQueue$3.run(EventQueue.java:709)\r\n\tat java.awt.EventQueue$3.run(EventQueue.java:703)\r\n\tat java.security.AccessController.doPrivileged(Native Method)\r\n\tat java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)\r\n\tat java.awt.EventQueue.dispatchEvent(EventQueue.java:726)\r\n\tat java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)\r\n\tat java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)\r\n\tat java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)\r\n\tat java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)\r\n\tat java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)\r\n\tat java.awt.EventDispatchThread.run(EventDispatchThread.java:82)\r\n\tat org.assertj.swing.edt.GuiActionRunner.execute(GuiActionRunner.java:98)\r\n\tat org.assertj.swing.edt.GuiActionRunner.execute(GuiActionRunner.java:72)\r\n\tat org.assertj.swing.driver.JTableDriver.scrollToPointAtCell(JTableDriver.java:494)\r\n\tat org.assertj.swing.driver.JTableDriver.showPopupMenuAt(JTableDriver.java:486)\r\n\tat org.assertj.swing.fixture.JTableFixture.showPopupMenuAt(JTableFixture.java:602)\r\n\tat GitHub_169_DisabledComponentTest.openPopupMenu(GitHub_169_DisabledComponentTest.java:47)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\r\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n\tat java.lang.reflect.Method.invoke(Method.java:498)\r\n\tat org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)\r\n\tat org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)\r\n\tat org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)\r\n\tat org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)\r\n\tat org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)\r\n\tat org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)\r\n\tat org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)\r\n\tat org.junit.rules.RunRules.evaluate(RunRules.java:20)\r\n\tat org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)\r\n\tat org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)\r\n\tat org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)\r\n\tat org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)\r\n\tat org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)\r\n\tat org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)\r\n\tat org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)\r\n\tat org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)\r\n\tat org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)\r\n\tat org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)\r\n\tat org.junit.runners.ParentRunner.run(ParentRunner.java:363)\r\n\tat org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)\r\n\tat org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)\r\n\tat org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)\r\n\tat org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)\r\n\tat org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)\r\n\tat org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)\r\n```\r\n\r\n"}}
{"actor":{"display_login":"aguelle"}}