I think you have misunderstood the problem. From my reading, the problem wasn't ransomware in Netbeans itself. The problem was that ransomware was spreading via booby-trapped Netbeans projects that had been uploaded to Github.
Netbeans itself never contained any form of malware. Rather, the bad guys had found a way to propagate malware which involved Netbeans projects ... and developers not taking the appropriate steps to validate the projects they downloaded from Github.
There were a couple of significant vulnerabilities in Apache Netbeans (CVE-2019-17560, CVE-2020-11986) in the last couple of years. Both have been fixed. I have not seen any evidence (or claims of evidence) that these are in any way implicated in the above problem.
Having said that, if you are uncomfortable using Netbeans, use a different IDE.
Sources:
1 - Given that other AVs have been pinged for doing this to Netbeans, I am inclined to think that it was actually an inaccurate report, or report that a number of AV vendors misconstrued, that lead the them flag Netbeans as malware. Either way, you might want to check that your Windows Defender's database is up to date.