NetBeans stops underlining errors in NetBeans refactored code - java

I'm having somewhat of a strange problem with NetBeans. I'm creating a program in Java that has multiple packages in it. I created 2 new classes for the project, but immediately afterwards I realized that I put them in the wrong package. So, I clicked the name of the class in the projects panel, dragged it to the appropriate package, and released. NetBeans then asked if I wanted it to refactor my code. This was the first time I've done this so I decided to preview it. It looked fine (just changed the package name) so I went ahead and moved the 2 classes over, allowing NetBeans to refactor them. This is where my problem comes in.
I realized while coding that NetBeans is no longer underlining the errors in my code, yet-to-be-finished lines, etc. It is instead just italicising the font. I thought this was strange so I decided to test it out in another class and for some reason everything worked fine in the other class. It turns out that NetBeans is only giving me this strange behavior in the 2 classes that it moved and refactored.
So I looked online and saw that you could change what NetBeans does with errors in Tools -> Options -> Fonts & Colors -> Syntax -> Category Error. I figured this would't work because this was obviously a preferences page for "everything." My settings were fine, so I changed the error setting, applied the change, and then changed it back to try and "re-force" the error highlighting preferences. Now NetBeans doesn't underline errors anywhere, and only italicises them.
In addition, the syntax highlighting preferences for everything (default, character, comment, etc.) that did not already have any effects color or effects setting now show "Effects: Wave Underline Effects Color: Red". And if that wasn't weird enough, they don't even "red underline." I've tried closing and reopening the classes and restarting NetBeans but nothing's working.
I took screenshots but unfortunately I can't post them because I don't have 10 Rep. Did I break my NetBeans? Thanks in advance.
EDIT: Even though my error setting were correct:
Effects: Wave Underline
Effects Color: Red,
restoring the default NetBeans settings for Fonts & Colors fixed my problem. Must have been some sort of strange bug?

Maybe is too late, but a have de same issue.
Try with Windows>Reset Windows.
In my case only happens in one class.

I had exactly the same problem with NetBeans 8.1 pressing 'Restore' and restarting worked for me.

Related

Netbeans 12.0 Not showing errors and attribute colors in java classes

I am currently working on a project for my first java team project. I have run into an issue where a certain class will suddenly stop showing errors (when I try to build my project, the output will show an error as shown in the screen capture, but I won't see an error in the text editor). I wrote a bunch of nonsense at the last line for you to see what I mean. Also, my attributes normally show in purple text and they now show in white text which is normally the indicator that the class in question won't show errors. This only affects some classes, most of them I worked on recently and have not been committed and pushed to my gitlab repo.
This makes coding a pain since I never know if I have made a stupid mistake until I try to build the project. I have not fiddled with the IDE, the only thing I did was change the font to the Jetbrains one and put on the default Netbeans dark theme.
Any help would be appreciated.
Try to delete Netbeans Cache folder (after closing Netbeans of course). On Windows systems it is usually located under C:\Users\<<username>>\AppData\Local\NetBeans\.

The cursor randomly disappears in Eclipse 2019-09 and sometimes stops writing

I have a very annoying problem with Eclipse 2019-09 (4.13.0) version: while I'm editing code (often when I copy and paste things or after accepting a code completion suggestion) the cursor (I'm talking about the text cursor: |) disappears completely! I cannot see it anymore, so I'm not able to detect on which part of the line I am! This is very annoying. I found a partial fix by installing the extension 'Vrapper': enabling and disabling it makes the cursor appear again.
Another problem I experience every time I press Ctrl+Space to ask for code completion suggestions, the cursor stops writing. After doing random things like switching tabs or opening new files the cursor starts to write again, but then the keyboard shortcuts stop working and I have to restart the entire IDE.
This behavior is intolerable, so I was wondering whether somebody else has had the same problem and how they have dealt with it.
The configuration of my system is:
OS: Debian, using i3wm+compton as a window manager on Xserver.
Thanks in advance.
Dead place, but I'm currently dealing with the same. The weird thing is that it happens on a per-file basis. Eclipse also treats that file as if it was not open, i.e. I can only save it through the 'Save all' method, not Ctrl-S ('Save') as I usually do. It's hellishly annoying, but it usually is fixed by reopening the file in question, and editing other files between the closing and reopening of other files.
If you have a better answer than this that you've found since, please, please post it here. It's annoying as all hell.
Minimize eclipse and maximize again.
Happened to me on Eclipse 2022-09 (4.25.0).

Eclipse Helios ignores breakpoints

Eclipse is driving me nuts right now. It's probably something trivial but I just don't get it. Whenever I like to add a breakpoint, the regular icons are crossed out in the editor and breakpoints view.
As you might have guessed, this isn't strictly a graphical problem ;) The breakpoints are simply ignored while debugging. The breakpoint's properties aren't helpful either.
Any hint is very well appreciated!
EDIT:
I've tested different JDKs without success.
I've successfully debugged projects in another workspace
Okay, so it's not about the JDK or the installed plugins. Seems to be workspace related. Anything I could try?
It seems you have the Skip All Breakpoints option enabled in the Breakpoints view.

AutoIndent in Eclipse possible?

I have been wracking my brain trying to figure this out. For the first time I used jEdit the other day and I was pleasantly surprised that it auto indented my code (meaning that I'd put in the following code:
int method () {
_ //<-- and it put me here automatically
I've tried to get the same thing working with eclipse but with no success. I got into the code formatter but I don't see how to make that happen.
Is it possible to do this? Also while I'm here, is there a such thing as a eclipse plugin that will allow you to search the methods and classes of the standard java library?
Thanks
Personally all I use for this is the format options Window->preferences under Java->Code Style ->Formatter.
I once took the time to tweek how I like my code to look like when I work and exported the whole thing. After that I just code without too much bother on what it looks like. When I find the code looks messy by pressing the combination ctrl+shift+f and the whole class becomes pretty again, comments and all.
After a while it pretty much became a reflex...
code code code
ctrl-s, ctrl-b (cause I disable auto build sometimes), ctrl-shift-f
code some more etc...
Once I got used to this I never really cared how it presented the code as i was typing because I knew it would look all pretty as soon as the loop/if/switch/method etc is finished
My clean eclipse install does this by default.
Have you changed any options? Make sure the file you are editing has the .java file extension. The preference options that control the typing automations are under Java -> Editor -> Typing in the Window -> Preferences menu.
Also, I find that the auto-indenting, and most of the other auto-complete functions of eclipse do not function well if the file I am editing has errors in it which prevent compilation. Make sure that your curly-braces are matched correctly, this is the main one that I've noticed blocks auto-indent.
Regarding searching through the standard Java libraries, use the Search -> Java.. menu option, and check the JRE libraries checkbox, then search away. You can also use the Hierarchy view to see how the classes relate. Also, in the Package and Project views you can expand the JRE System Library, and then expand rt.jar which holds pretty much all the standard Java pacakges.
Eclipse has always done this for me by default.
One really cool thing about eclipse is that you can search preference pages. Just right click and go to prefrences. Go to the "Window" menu, and click "Prefrences". Then at the top of the tree view there's a text box that says "type filter text". Replace that with "indent" and it should bring up the page where the indent option is.
Make sure that eclipse recognizes your file as a java file, that you're using the Java distribution, the latest version, etc.
Iv been trying to work around the eclipse indenting and other supposed features for years, and it seems that the bottom line is this ...
It only works for the programming style of the authors, so to use it you need to modify your style to comply.
This would be OK except that the authors of eclipse have some very strange ideas about common shortcut keys.
One horrid example is the search features, eg when did Ctrl+K become "Find Next occurrence" and why doesnt F3 or n work?
That all being said I use eclipse because if you have the time to wait around while it starts up - or never close it - and you can modify everything youve learned about using an editor - why why why - then it will certainly increase your efficiency.
Please note that there is a preference setting for indenting, it can be set for a project, a workspace, or globally, but no matter how you set it eclipse will still chuck tab characters in where you dont want them.
In fact its indent crazy, like it wants to indent everything, even if its already indented.
Like I said Iv been using it for years and it STILL drives me nuts with its random behavior.
Follow these steps for Eclipse:
Select all text: ctrl+A
Correct indentation: ctrl+I
You should check:
Hidden features/tricks for Eclipse?
What is your favorite hot-key in Eclipse?

Eclipse and JavaFX? is it just me?

I'm looking at learning JavaFX.
I've tried setting Eclipse to develop a small app and I've downloaded the Eclipse plugin.
Eclipse JavaFX plugin
BUT... it just seems, well, flakey.
So I have 3 questions...
1: Is there a better plugin?
2: Or is there some great set of tutorials out there that I'm missing?
3: finally, is it meant to be easy to call Java code from FX? I'm stuggling, it there a good example somewhere?
On questions 1 & 2, Eclipse underlines code in red that just shouln't be. For example..
see this image... alt text http://www.qenet.co.uk/fx.jpg
Why does it underline bit of imports in red?
I know this is little of an open ended question. So I guess my main question is this...
Is my experiance of JavaFX and Eclipse the best I can hope for? Or am I missing something ?
(and I'm not looking for a Yes/No response) :-)
Just looking for a discussion on how best to learn/develop JavaFx.
This kind of thing is not unusual. A lot of Eclipse plugin editors have problems dealing with error tags and the like. For example,
I find that the XML and HTML file editors often fail to clear error and warning markers, and the only way to get rid of the markers it is close and reopen the file.
Even the Java viewer gets it wrong in some circumstances, though the problem goes away when the relevant files are saved.
When you update a spelling dictionary, the spelling checker is not rerun and the spelling error markers are not updated. In fact, you have to restart Eclipse for this to happen.
I suggest that you try saving files, and closing/reopening editors to see if that makes the bogus error markers go away. Then decide whether Eclipse is the right IDE for this task.
I've never used NetBeans (at all), but you would expect that it would do a better job supporting JavaFX. After all NetBeans and JavaFX are both high profile Sun products at the moment.
Netbeans is really the only way to go at the moment for JavaFX development. They are both Sun products and Sun has made sure the two work very well together. Before long Eclipse and others will catch up but for the moment that's how it is.
There is another JavaFX plug-in for Eclipse from Exadel. You can download it here: http://exadel.org/javafxplugin. Give it a try.
I have similar problems but funnily only under Linux, not Windows. Hope they change that soon.
To me this has happened when I wronlgy installed javafx sdk 1.2.3....This plugin works only with 1.2.1... :/

Categories