java.beans.PropertyEditor.paintValue() from JComponent.paintComponent()?



Hello. I am attempting to put together a property sheet using a
JTable.

I understand the cell rendering and cell editing mechanics very well.

I am attempting to do this using java.beans.PropertyEditors where
possible, so that, for example, I can take advantage of the
sun.beans.editors.* classes. Also it just smells good; code reuse is a
good thing.

What I don't understand is how to pass the correct values to
PropertyEditor.paintValue(Graphics, Rectangle). More accurately, I
would like to know if the behavior I see from
sun.beans.editors.ColorEditor is correct or not.

As I understand it, PropertyEditor.paintValue(Graphics, Rectangle) is
probably intended to be called from some Component's paint(Graphics)
method, or, more likely in Swing's case, from JComponent's
paintComponent(Graphics) method. So that's what I'm doing.

I'm also guessing that since the JComponent in this case that will be
calling PropertyEditor.paintValue(Graphics, Rectangle) is a table cell
renderer, that it should simply pass Graphics.getClipBounds() for the
Rectangle argument. I have deduced from reverse engineering a lot of
the Sun code that the Rectangle is not supposed to be null, so I have
to supply something. It makes sense to me to supply the clip, whatever
it may be, and not the bounds of the component in question.

Does that make sense?

Anyhow, if I do this, I do indeed get a perfectly functioning property
sheet, and lo and behold the sun.beans.editor.ColorEditor code gets
invoked, and the table cell in this case turns a lovely shade of
green--but it's off by a couple pixels. That is, the bottom and right
edges are painted white, not green. It looks like a border problem,
but I don't think that's it.

Should I pass the clip rectangle (which would mean among other things
that sun.beans.editors.ColorEditor is buggy)? Or should I pass the
component boundaries itself and override paint() instead of
paintComponent()?

Thanks,
Laird

.



Relevant Pages

  • RE: Help with developing sudoku gui using GDI+
    ... x/y mouse coordinates to indices in your array. ... Let's assume that your grid ... information like the number that is already filled in on the cell. ... the selected rectangle. ...
    (microsoft.public.dotnet.framework.drawing)
  • Help with developing sudoku gui using GDI+
    ... I am trying to develop a sudoku solver, I have done in VB6 already(80% ... I used Rectangle Classes to create them and also Region ... I will draw them on onpaint event. ... the mouse is moved over any cell, i want to highlight that cell with a ...
    (microsoft.public.dotnet.framework.drawing)
  • Invalidating: rectangles or regions
    ... only know about a bounding rectangle. ... potentially has to get done to draw each grid cell. ... I override OnPaintin this user control and dump out the clip ... The same is for .NET if you invalidate a region the Paint event args contain ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Code to change the color of "Rectangle21_Click"
    ... Why not skip the rectangle and use the Change event or the calculate event ... to change the background color of a cell since you are exceeding the ... You can unprotect the sheet in your code and change the background color, ... the password with the protect command. ...
    (microsoft.public.excel.programming)
  • Re: vlookup
    ... (All one cell. ... You may want to just put a formula to return the value from each sheet in it's ... > the Property sheet? ... >> Dave Peterson ...
    (microsoft.public.excel.misc)