Every time I run certain GUI interface excercises using swing the program works perfectly but something is wrong with what I suspect might be the jdk or something as it also happens like this on Eclypse.
It first appears to show correctly but with mouse over or when entering data in a textfield it all shows distorted.
Has anyone encountered these problems?
I managed to fix the problem re-installing the drivers to my graphics card!
Thank you.
Hope this helps anyone in the future with the same issue
Related
I'm here to talk to you about a problem I got today working for the first time whit this new class called "Robot" of the library java.awt.
I must say Robot works fine, but troubles come every time i stop the application. My keyboard doesn't recognize any command and when i try to write something, random Windows appear everywhere,
as if the keyboard no longer recognizes the predefined keys. is there anyone who knows the reason for this strange behaviour and knows how to solve these issues?
thank you very much!
thankyou MadProgrammer, your observation was right! I solved my problem.
I'm sorry I didn't provide an example related to my question but I was sure that someone would nave understood my problem.
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.
Okay I haven't had a problem with NetBeans in the past. It's my preferred IDE because it will put an error notification type thing next to a line of code that is wrong. Example would be if I forgot a semicolon or accidentally put Jlabel instead of JLabel. Somehow last night it stopped doing that for me. I think maybe I pressed a button or accidentally changed a setting(Or maybe I need to update it?).
Anyway, if anyone knows how to fix this please let me know as if makes error catching take longer.
Thanks in advance!
Please update your NetBeans installation.
There were some issues regarding error highlighting recently, but they should be fixed now.
I'm having this issue in my MATLAB program.
I want to perform a set operation on my UI during a coding. In other words I'm pressing a button to launch my code and at the same time I want to change some uicontrols.
I tried with pause and wait with no luck.
I'm pretty sure that MATLAB gives priority to my coding part intead of the Java interface.
Anyone has any idea? Thanks
Thanks to nick I solved adding
waitnow; pause(.1);
Guys, unbelievable, that works on linux/OSX but not under windows..that's so weird
I am very new to Eclipse, java programming and well all "programming" in general and I have recently been learning how to use Eclipse. I've been using it for about a week now and it has been going decent so far. Apart from some errors,(mostly on my part) that has been fixable by restarting the program itself.
However when I started using it today I could no longer see the suggestions made from the Quick Fix command, for example if I type findVi and then press CTRL+1, it shows "No suggestions available" instead of "findViewById()" or something similar.
I know it's the correct binding, I even reset the keys to default to be sure. It still finds the ID if i type it manually but I would like to able to finish words faster that way.
If you guys got any suggestions that can help me out, please let me know.
Thanks.
- First of all if you are new with Java, and want to practice Java, you should NEVER USE ANY IDE, that way you learn the proper syntax, and it helps your error finding skills.
- But as you wrote "findViewById()" it seems that you are doing Android, Now this happens sometimes that Eclipse behaves weirdly with Android. Thats the reason when you make any changes into your Eclipse GUI while working with Android, its always better to see if those changes have taken effect.
- This problem usually goes off after closing and re-opening the Eclipse once or twice.
- Ok try this....
Type findVie then press Ctrl + Space-Bar See if the suggestion pops up...
You can access the Content Assist preferences from Window > Preferences > Java > Editor > Content Assist... perhaps something got messed up.