Strange java error.

Caporegime
Joined
12 Mar 2004
Posts
29,962
Location
England
Netbeans is giving me this:
error345.jpg


for this,

Code:
blackBorder = new BorderFactory.createLineBorder(Color.black);

Why does netbeans think the createLineBorder method is a class? :confused:
 
There's your problem.

Code:
blackBorder = [COLOR="Red"][B]new[/B][/COLOR] BorderFactory.createLineBorder(Color.black);

The createLineBorder(...) method is a static member of the BorderFactory class and doesn't require an object instantiation. Just remove the new keyword.
 
That's pretty bad if it's on Sun's website because it's nowhere near valid, even if the method was not a static member then the new keyword would still be invalid, it would need to have a constructor call in it.

Code:
blackBorder = new BorderFactory[B][COLOR="Red"]()[/COLOR][/B].createLineBorder(Color.black);
 
When I run the program I get a huge window that is wider than the screen, but when I resize it, instead of the jbuttons getting smaller they dissappear off the screen completely, how can I make them shrink instead of vanish?

That's pretty bad if it's on Sun's website because it's nowhere near valid, even if the method was not a static member then the new keyword would still be invalid, it would need to have a constructor call in it.

Code:
blackBorder = new BorderFactory[B][COLOR="Red"]()[/COLOR][/B].createLineBorder(Color.black);


Oh no, the correct version was on suns website, but somehow I must have added a new or pasted it next to it or something!
 
Back
Top Bottom