Since upgrading to Intellij 14 I'm having this strange issue where focus gets permanently stolen by the Project tree structure window so that I cannot Code. When I try typing or high-lighting nothing works...neither by keyboard nor mouse. When I type letters it starts searching through the project hierarchy.
Is anyone else experiencing this extremely obnoxious behavior and does anyone know how I can avoid having it happen. The only work-around I've found is to close intellij and re-launch. There seems to be no other way to get focus back to the coding window.
Tagging this question Java since our app is written in Java and I'm just trying to edit classes.
Related
I'm making a basic game with Slick2D, and have pretty much followed thenewboston's tutorials to the line, up to the episode I have linked. However, when I run the code, the game window starts out of focus, in the background of my other windows. When I manually select it to look at it and bring it into focus, it looks like this:
Sometimes it's just a black window, and sometimes it's this glitchy-looking mess. Also, If you'll notice, the window itself has out-of-focus graphical qualities, even while in focus. None of the buttons at the top left do anything or even graphically respond to a click/hover. However, the window does close upon termination of the program.
I run LWJGL v2.9.3, Slick2D build 237, IntelliJ IDEA CE 2016.3.1 (tested with 2016.2.4 as well), and Mac OS 10.12 Sierra. I've tested this separately with Java 7 and 8, and both produce this result. If anyone can help, I thank you wholeheartedly in advance.
Edit: I've tried running a generic Slick2D demo from the internet (which can be found at gist.github.com/massimomusante/5459957), which should work since I assume it's a tested and very simple demo, but the same kind of thing happens with the out-of-focus black window. So I know it has to do with my setup rather than my game. In terms of native Slick2D/LWJGL stuff, I've tried running the original code with both the packaged Slick2D natives and the LWJGL natives, and the issue still persisted, so natives are likely not the issue either.
Ok, so this is a really, REALLY weird issue that we're having with the application at my company. I'm going to try and describe this as best I can.
First, this is a legacy application with a Swing UI.
Second, the issue only occurs when it is compiled & run using Java 8. With Java 7 and below, this does not occur.
So, the issue: When a dialog is displayed (modal or non-modal, doesn't matter), the UI becomes unresponsive to mouse clicks. What's truly crazy, though, is the UI is NOT frozen. Hovering the mouse over something produces the hover highlight as normal. Keyboard commands are received perfectly. Mouse clicks, however, do not work.
This also only occurs on OSX. Windows and Linux don't have this problem. I'm running this on OSX El Capitan.
As far as code samples, it's affecting all dialogs across the application. JOptionPanes & JDialogs, doesn't seem to matter. Here's a simple JOptionPane declaration:
int n = JOptionPane.showOptionDialog(mcContext.getMapperView(), "xPath of dropping target can't be evaluated" +
"\nPlease, select xPath for dropped node",
"xPath calculation for dropped node",
JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]);
This code IS being called on the EventThread, so I don't believe it's a threading issue.
I'm totally stumped as to the cause of this. So far we've ignored it by compiling and running it in Java 7, but at some point as versions progress we will need to deal with this issue more directly.
Anyone have any ideas?
Edit: Thanks for the SSCCE Idea. Now I'm more confused than ever. When I put together a quick frame/dialog demonstration, it worked perfectly. No issues. So I don't know what it is in the application that could be causing this. Any good places to start looking?
Edit 2: Wrapped one of the declarations in SwingUtilities.invokeLater, and it worked. Ok... now what could the culprit be? It's still got to be something that Java 8 is compiling different than Java 7.
Edit 3: More weird behavior. I moved my IDE into a separate "desktop" than the application it was running, and when the buggy dialog is displayed, i cant switch to that desktop. I can switch to any app on the current desktop, but not to another desktop.
Edit 4: The dialogs in question are being triggered by drag and drop actions. Not sure if that helps or not, but I do see that there is a thread in the background in the thread dump using the sun.lwawt.macosx.CDragSourceContextPeer class.
Alright, it took a while, but I think I found it. I found an OpenJDK post that seemed to very clearly describe this issue.
https://bugs.openjdk.java.net/browse/JDK-8139393
Somehow, Drag N Drop in Swing on OSX in java 8 isn't releasing its hold on the MouseEvent or Listener, so when a modal dialog is displayed the mouse isn't able to get new events through to it. Which is a crazy stupid bug, but it's there.
The solution was wrapping my code in SwingUtilities.invokeLater(...). By having the code that displays the dialogs executed asynchronously from the drag and drop code, the drag and drop operation is able to complete and release its hold on the mouse connectivity (for lack of a better description). And viola! Problem solved.
Thanks to everyone who tried to help. Hope this post helps out anyone else dealing with this issue.
I have recently switched from IntelliJ IDEA Community Edition version 12, to version 13 (updated to 13.0.1) and apparently the real-time ("on-the-fly") compilation of code does not work, at least not as found in other major IDEs (e.g., Eclipse).
A similar issue has been brought up in an earlier StackOverflow question and the answer was to check the corresponding option in File -> Settings -> Compiler, which I have of course done, but nothing changed.
The way it currently is, I can type whatever text in the Java code and there is no error highlighting, not even when the file is saved, let alone in real time.
Is there another setting or configuration that needs to be applied?
IntelliJ does something a lot better than compiling your files on the fly. It dynamically parses what you're typing, offering many more warnings than the java compiler produces. In comparison, compiling on the fly is a bad idea. Having said that, it sounds like you're having other problems, because you should have errors and other problems highlighted. At the top right of each editor window is a small coloured square. On good code it's green. It's yellow when there are warnings, and red when there are errors. If it's grey then Idea is analyzing your files. If you hover your mouse over the square it'll give you an idea about what Idea is doing, and how it's progressing. Try that before you try anything else. Idea never gets stuck, but it can run out of memory, if the analysis isn't progressing, then perhaps you've run out of memory, or have other issues, check this in the event log, which is at the bottom right of the window.
I've just been pulling my hair out over this working on my Mac in a coffeeshop running on battery power. Try File | Power Save Mode and make sure it's un-checked.
I recently tried to open a JPanel form that I created with NetBeans GUI Builder and NetBeans almost freezes up on me. The design form is an all-gray background, not the usual gray area where I can place components surrounded by a white background. If I click on the Source button and then switch back to Design view, all of the tabs in the editor pane disappear.
Fortunately I am using Git for version control. The last commit of this file was over a week ago. I might have to revert to an earlier version to see where this problem was introduced. In the mean time, does anyone have any idea what could cause this behavior? Is it possible that my .form file is corrupted? The application compiles and runs just fine.
It sounds like Netbeans can't load the form due to some internal error. This can sometimes be fixed by doing a clean & build to clear out any old cached data.
If that doesn't work, you can check out the "message.log" for the error...and yes, I wish it would display it on the screen
Off memory it use to be in "{user.profile}/.Netbeans/{version}/var/log" (I think). It got moved on Windows under 7.2 to "{user.profile}\AppData\Roaming\NetBeans\7.2\var\log"
Lately, I've been working on a project in NetBeans using the GUI editor that's built in. Before I noticed that it generated an XML ".form" file that didn't appear in the Project Explorer Pane which makes sense. Earlier I was working on the form in the "Design" tab when it notified me about 15 updates. I just updated without reading anything which was probably a bad idea but when I restarted the IDE, it showed my GUI ".class" file and ".form" file separately in the Project Explorer and I couldn't switch between "Source" and "Design". I also noticed that the generated code that was usually not editable was now editable.
P.S. I'm able to create a new frame just fine and the design editor still works with new frame
I have encounter the same problem and I have solved it.
The key in this problem, I think, is particular plugins for JFrame in Netbeans are not active after updating, so we only need to activate them. The easiest way to achieve this is create a new JFrame class, so in this progress, NetBeans can activate all relevant plugins for us. Finally, restart NetBeans, then everything would be fine.
Thank you very much for all of you that you give me some idea and clues in this situation:)
Work on a similar problem led me to this discussion concerning Guarded blocks inside form Java source file. I'm not sure it's related to your situation, but it may help you recover.
If you are trying to recover the lost state of the backing xml for the form I don't know what to tell you.
This has happened to me, but I tend to highly componentize the forms (break up the forms into little pieces), which makes this not such a big deal. Have you tried the NetBeans forums? You might get better luck there:
http://forums.netbeans.org/
Nevermind, simple solution.
I finally decided that, after plenty of tinkering, to restart the IDE which I should have though of first. The Java SE Plugin must have crashed or something, anyway it's fixed.
Thanks for the help!
Or just right click on the corresponding .form file and select open. The Design tab/editor reestablishes.