[Biojava-l] SequencePanel arbitrary setGraphicsOrigin

Keith James kdj@sanger.ac.uk
24 May 2001 17:06:36 +0100


Hi,

I'm working on a couple of things related to the sequence gui code,
namely:

A new FeatureRenderer to do 'mixed types of beads on a string'
rendering for protein domains etc (rather than overlaying several
SequenceRenderers)

Dumping png images of rendered features.

When using a Graphics2D obtained from a SequencePanel to output a png
image I'm getting all the features mysteriously offset a bunch of
pixels to the right (although things seem fine on the gui panel
itself).

I've tracked this down to

setGraphicsOrigin(50.0-sequenceToGraphics(range.getMin()));

being called in paintComponent()

This results in features vanishing off the right hand edge of the
image and corresponding blank space to the left. If I comment this
out, all returns to normal.

David, I gather that you put this in to fix a particular problem, but
is there another way? Or can someone suggest something? 

I can call setGraphicsOrigin(), but I have to know how much negative
offset to apply (which isn't documented in the API docs) and when to
apply it because the origin gets shifted back again by several other
methods i.e. all the MouseEvent ones. Or am I missing something
obvious?

Help?! thanks,

-- 

-= Keith James - kdj@sanger.ac.uk - http://www.sanger.ac.uk/Users/kdj =-
The Sanger Centre, Wellcome Trust Genome Campus, Hinxton, Cambs CB10 1SA