last day (15 days later) » 

9:42 PM
0
Q: Eclipse: insert '}' to complete block

Bogdan DanielI have the following code to draw a rectangle which works just fine: public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; g2.setStroke(new BasicStroke(10)); g2.setPaint(new Color(128, 0, 0)); Rectangle2D.Double ...

 
The code is correct, are you sure you've saved/rebuilt properly?
 
There is nothing wrong with it. I just put it in my eclipse and it only returned warnings. No errors.
 
Aside from the ArrayindexOutOfBoundsException you will get - the code you posted will compile.
 
I know, I verified it line by line for 5 minutes. I have no idea why it complains
Yeah I saved it, I even restarted eclipse
@copeg Still can't get it to work
 
This could possibly be an Eclipse related bug. Don't use Eclipse.
 
9:42 PM
@jyoon I like Eclipse a lot, and java. I have no idea though how to solve that
 
Try out NetBeans or IntelliJ. You will like it. Alternatively you can create a new project and move the code over.
I really see no error in your code.
 
@jyoon yeah... this is so annoying
 
user146043
This is probably something where you've got a dodgy JDK or something. Can you create a new project and print "hello world"? If that works, then slowly add the code in from this app and see if/when it breaks.
 
Clean the project.
 
@Alex I have no idea why it works with the first code, and with the second it complains.
@IanMcLaird I went Project --> Clean and I still get the same error
I had no idea this site had a chat option. This is so cool. Do you have any more suggestions on how to solve this ?
 

last day (15 days later) »