문제

I am now trying to learn java tree in java oracle tutorial here at creating a tree part. I have difficulties to implement the code inside my netbean jframe. where should i put the code. currently i put the code inside my public class jframe as shown below but return error.

enter image description here

도움이 되었습니까?

해결책

private void createNodes(DefaultMutableTreeNode top) { //illegal start of expression

Whoa, from the looks of your image, the method createNodes is inside the constructor, Hence //illegal start of expression. You'll want to take that out of the constructor and put it on the class level.

Side Note

  • In Netbeans, make use of Shift + Alt + F to properly indent your code. You may notice errors you wouldn't see otherwise, like maybe this one :)

  • Providing us with actual text code is much more effective than providing a screen shot of your code.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top