Reputation: 23510
In NetBeans I created a class: java.awt.Canvas (I use -XBootClassPath). In this class, I add a function call: "addPaintListener".
When I compile, it works fine. I can write code like (In netbeans. No errors):
public static void notifyCanvasReady(Canvas canvas) {
canvas.addPaintListener((PaintListener) g -> {
g.setColor(Color.white);
g.drawString("HELLO WORLD", 50, 50);
});
}
But in IntelliJ, it gives me an error:
However, if I Right-Click the project and hit compile module, it compiles fine (still shows the error) but actually runs regardless.
Any idea how I can get it to stop showing the error or get it to recognize my modified internal class?
Upvotes: 0
Views: 164
Reputation: 26482
The comments are right that you are not supposed to modify JDK classes, if you are not a JDK engineer. However let's assume you really want to do this. The following should work:
File | Project Structure...
Modules
in the left panelDependencies
tab in the right panel<Module source>
up above the JDK in the table using drag&drop or the arrow buttons at the bottom.Here's what the dialog looks like. <Module source>
should be at the top of the table, above the 1.7_15
JDK.
Upvotes: 1