Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #4824

JTable Editors and Renderers

From Novice <novice@example..com>
Newsgroups comp.lang.java.gui
Subject JTable Editors and Renderers
Date 2011-12-11 15:01 +0000
Organization Your Company
Message-ID <Xns9FB86609C49F3jpnasty@94.75.214.39> (permalink)

Show all headers | View raw


Can anyone point me to a better explanation of JTable Editors and Renderers 
than the one in the Java Tutorial?

I'm struggling with getting some simple editors to work and I'm not finding 
the Java Tutorial awfully helpful on this subject. They throw out various 
facts that are interesting and even tantalizing but it's not systematic 
enough that I can really figure out how to do what I want to do. For 
instance, they talk about renderers and editors and indicate that you can 
make your own but I can't figure out if creating your own editor means you 
also have to create your own renderer on those columns.I used to have a 
better article on the subject bookmarked but I see that the link is dead 
now; apparently DeveloperWorks has purged some articles. A search of their 
site doesn't bring up the article at a new URL. 

At the moment, I've got an editor on one of my columns and I can see that 
it is being instantiated and invoked but it's not doing what my code tells 
it to do. All it does is turn the cell gray and refuses to let me edit the 
cell or even show the data that is in it. My code is actually indicating 
that it should draw the cell and data in completely different colors and is 
putting a particular word in the cell but none of that is happening and I 
don't know why.

I'm confused about the interaction of default renderers and editors and how 
they interact with custom-created editors and renderers. I'm also very 
unsure about exactly what provokes each of the methods in these classes to 
execute.

I have a custom-created editor on one of my columns and am relying on the 
default renderer on both columns of my table. The column that uses the 
default renderer and editor works fine and I can overtype the text in that 
column. I don't know how to enforce certain rules within that cell though, 
such as an absence of certain characters. 

The other column has the customer editor displays the data okay until I 
click on it, then it turns gray and I can't do anything with it. Do I need 
to have a custm renderer for that column too?

A systematic description of editors and renderers would probably sort 
things out for me if someone can point me in the right direction.

-- 
Novice

Back to comp.lang.java.gui | Previous | NextNext in thread | Find similar


Thread

JTable Editors and Renderers Novice <novice@example..com> - 2011-12-11 15:01 +0000
  Re: JTable Editors and Renderers "John B. Matthews" <nospam@nospam.invalid> - 2011-12-11 19:40 -0500

csiph-web