This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes can i override two methods Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "can i override two methods " Watch "can i override two methods " New topic
Author

can i override two methods

cchetan jain
Ranch Hand

Joined: Jul 05, 2009
Posts: 30
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

Joined: Jul 05, 2009
Posts: 257
Are you using an IDE to write the code? I am really confused with you code's braces.


Experience and talent are independent of age
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32838
    
    4
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
Ranch Hand

Joined: Jan 12, 2009
Posts: 915




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.


My Website: [Salvin.in] Cool your mind:[Salvin.in/painting] My Sally:[Salvin.in/sally]
Himanshu Kansal
Ranch Hand

Joined: Jul 05, 2009
Posts: 257
I too am doubtful of the braces. Would like to know what the compiler said!
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 16487
    
    2

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
Ranch Hand

Joined: Jan 12, 2009
Posts: 915

I am still curious to know what the compiler said .....
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: can i override two methods
 
Similar Threads
jtable highlight cells (refresh issue)
JTable - can different rows be set to different colors?
Jtable retreiving data
How To Color Row In JTable
fill color in alternating rows in jtable