• Post Reply Bookmark Topic Watch Topic
  • New Topic

can i override two methods  RSS feed

 
cchetan jain
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
have made a object of JTable.but now i want to avoid user editing and set the color to the alternate tables..
but problem is that this code gives the compile time error.
now how can i do it.
one solution to this problem is that i extends the JTable and override these methods..and then make a object of that..
bt i want to ask that is there another solution for that.

;
please help me ..what is the problem in this..
 
Himanshu Kansal
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you using an IDE to write the code? I am really confused with you code's braces.
 
Campbell Ritchie
Marshal
Posts: 56570
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please supply more details. Which compiler error do you suffer? And, as you have been told, your poorly-indented code is very difficult to understand.
 
salvin francis
Bartender
Posts: 1663
37
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



did this via : http://www.prettyprinter.de


If i am not wrong, Is your code using code blocks for no apparent reason at all ???
I wonder the scope of the functions in that case.
 
Himanshu Kansal
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I too am doubtful of the braces. Would like to know what the compiler said!
 
Paul Clapham
Sheriff
Posts: 22835
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
salvin francis wrote:If i am not wrong, Is your code using code blocks for no apparent reason at all ???
I wonder the scope of the functions in that case.


My guess is that those code blocks were part of an anonymous subclass of JTable originally, but the call to setModel() was inserted in the middle, thus orphaning them and making a mess of the code. Here's a small example of making a JTable which isn't editable:

And in answer to the question in the post title, yes, you could override a second method by putting it inside that block right after the declaration of isCellEditable.
 
salvin francis
Bartender
Posts: 1663
37
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am still curious to know what the compiler said .....
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!