[Biojava-dev] Help required for the Use of SequencePanel and
RectangularBeadRenderer
Shuvankar Mukherjee
shuvankr at hotmail.com
Thu Sep 2 07:15:58 EDT 2004
Hi,
I am trying to use a SequencePanel which has a MultiLineRenderer, which will be using a
RectangularBeadRenderer to show Genes.
However, it seems that to render a Feature , a Graphics object needs to be passed in the renderBead () method.
I am using the graphics object of SequencePanel , but nothing is getting rendered.
Could any one advise what should be the steps the do this...
My code is like the following ( Based on FeatureView class from the 'biojava in anger' docs)
------------------------------
jPanel1.add(seqPanel, null);
//add Renderers to the MultiLineRenderer
mlr.addRenderer(seqR);
fbr.setFeatureRenderer(rbr);
mlr.addRenderer(fbr);
//set the MultiLineRenderer as the SequencePanels renderer
seqPanel.setRenderer(mlr);
//set the Sequence to Render
seqPanel.setSequence(seq);
//display the whole Sequence
//seqPanel.setRange(new RangeLocation(1,seq.length()));
System.out.println("before grab");
graph = (java.awt.Graphics2D) seqPanel.getGraphics();
System.out.println("after grab");
if(graph != null)
{
System.out.println("grab successful - rendering Bead");
rbr.renderBead(graph,f,seqPanel);
System.out.println("Rendered Bead");
}
fbr.setFeatureRenderer(rbr);
mlr.addRenderer(fbr);
...
...
...
private FeatureRenderer featr = new BasicFeatureRenderer();
private SequenceRenderer seqR = new SymbolSequenceRenderer();
private SequencePanel seqPanel = new SequencePanel();
//the proxy between featr and seqPanel
private FeatureBlockSequenceRenderer fbr = new FeatureBlockSequenceRenderer();
private RectangularBeadRenderer rbr = new RectangularBeadRenderer();
private java.awt.Graphics2D graph=null;
private Feature f=null;
...
Shuvankar Mukherjee
More information about the biojava-dev
mailing list