[Biojava-dev] SequencePannel fixed?

Keith James kdj@sanger.ac.uk
17 Oct 2002 10:51:44 +0100


>>>>> "Thomas" == Thomas Down <td2@sanger.ac.uk> writes:

[...]

    >> As is subclasses JComponent it needs to paint its own
    >> background i.e.
    >> 
    >> if (isOpaque()) { g2.setPaint(getBackground()); g2.fillRect(0,
    >> 0, getWidth(), getHeight()); }

    Thomas> Sun's recommended way to do this is to call paintComponent
    Thomas> on the superclass before drawing your own stuff.  I guess
    Thomas> that's a nicer way of doing things, since it means that
    Thomas> any wierd stuff in the JPanel UI delegate will be called
    Thomas> properly.

That's true - it was on my patch list for SequencePanel today,
although I didn't mention it. TranslatedSequencePanel already does
this.

However, trying to do without the manual background drawing results in
a permanently grey background (whatever colour it is set to), even
when calling super.paintComponent(). Therefore I'm putting both
changes in.

cheers,

Keith

-- 

- Keith James <kdj@sanger.ac.uk> bioinformatics programming support -
- Pathogen Sequencing Unit, The Wellcome Trust Sanger Institute, UK -